From 8f678023111e3660b7234799c14f79e5391be6e7 Mon Sep 17 00:00:00 2001 From: eliotRosewater Date: Wed, 6 Dec 2023 13:10:14 -0500 Subject: [PATCH] Inside of setupCallHandler() changed it to return from await. --- .../background_android_isolate_platform.dart | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/lib/src/platform/src/background_android_isolate_platform.dart b/lib/src/platform/src/background_android_isolate_platform.dart index 5563fe0ff..66ed831cb 100644 --- a/lib/src/platform/src/background_android_isolate_platform.dart +++ b/lib/src/platform/src/background_android_isolate_platform.dart @@ -20,17 +20,14 @@ class BackgroundIsolateAndroidPlatform { _methodChannel.setMethodCallHandler((call) async { switch (call.method) { case PlatformMethod.pushOnBackgroundMessage: - await _onPushBackgroundMessage(call.arguments as RemoteMessage); - return; + return _onPushBackgroundMessage(call.arguments as RemoteMessage); default: - throw PlatformException( - code: 'invalid_method', message: 'No such method ${call.method}'); + throw PlatformException(code: 'invalid_method', message: 'No such method ${call.method}'); } }); } - static final BackgroundIsolateAndroidPlatform _platform = - BackgroundIsolateAndroidPlatform._internal(); + static final BackgroundIsolateAndroidPlatform _platform = BackgroundIsolateAndroidPlatform._internal(); /// @nodoc /// Singleton instance of BackgroundIsolateAndroidPlatform @@ -40,19 +37,15 @@ class BackgroundIsolateAndroidPlatform { /// A method channel used to communicate with the user's app isolate /// we explicitly launched when a RemoteMessage is received. /// Used only on Android. - final MethodChannel _methodChannel = MethodChannel( - 'io.ably.flutter.plugin.background', StandardMethodCodec(Codec())); + final MethodChannel _methodChannel = MethodChannel('io.ably.flutter.plugin.background', StandardMethodCodec(Codec())); - final PushNotificationEventsInternal _pushNotificationEvents = - Push.notificationEvents as PushNotificationEventsInternal; + final PushNotificationEventsInternal _pushNotificationEvents = Push.notificationEvents as PushNotificationEventsInternal; - Future _onPushBackgroundMessage(RemoteMessage remoteMessage) async => - _pushNotificationEvents.handleBackgroundMessage(remoteMessage); + Future _onPushBackgroundMessage(RemoteMessage remoteMessage) async => _pushNotificationEvents.handleBackgroundMessage(remoteMessage); /// @nodoc /// Equivalent of [Platform.invokePlatformMethod] which cannot be used here /// because we may not be able to acquire [Platform] instance here, so we /// need to use a raw [MethodChannel] communication - Future invokeMethod(String method, [dynamic arguments]) async => - _methodChannel.invokeMethod(method, arguments); + Future invokeMethod(String method, [dynamic arguments]) async => _methodChannel.invokeMethod(method, arguments); }