callbackDispatcher function
void
callbackDispatcher()
This method is the entry point of the background isolate. A Method Channel is created that can run in the background and listens for methods from the native side.
Implementation
@pragma('vm:entry-point')
void callbackDispatcher() {
WidgetsFlutterBinding.ensureInitialized();
const MethodChannel _backgroundChannel = MethodChannel('flutter_nm_sdk_background');
_backgroundChannel.setMethodCallHandler((MethodCall call) async {
final List<dynamic> args = call.arguments;
final Function callback = PluginUtilities.getCallbackFromHandle(CallbackHandle.fromRawHandle(args[0]))!;
Map<dynamic, dynamic> bundle = args[1];
callback(bundle);
});
_backgroundChannel.invokeMethod('serviceInitialized');
}