flutter_umeng_method_channel.dart 1007 B

1234567891011121314151617181920212223242526272829303132
  1. import 'package:flutter/foundation.dart';
  2. import 'package:flutter/services.dart';
  3. import 'flutter_umeng_platform_interface.dart';
  4. /// An implementation of [FlutterUmengPlatform] that uses method channels.
  5. class MethodChannelFlutterUmeng extends FlutterUmengPlatform {
  6. /// The method channel used to interact with the native platform.
  7. @visibleForTesting
  8. final methodChannel = const MethodChannel('flutter_umeng');
  9. @override
  10. Future<void> setPolicyGrantResult(bool granted) async {
  11. return await methodChannel.invokeMethod('setPolicyGrantResult', {
  12. "granted": granted,
  13. });
  14. }
  15. @override
  16. Future<void> initCommon(
  17. {String? androidAppKey, required String iosAppKey}) async {
  18. String? appKey;
  19. if (defaultTargetPlatform == TargetPlatform.android) {
  20. appKey = androidAppKey;
  21. } else if (defaultTargetPlatform == TargetPlatform.iOS) {
  22. appKey = iosAppKey;
  23. }
  24. return await methodChannel.invokeMethod('initCommon', {
  25. "appKey": appKey,
  26. });
  27. }
  28. }