registerBackgroundCallback method
Implementation
@override
Future<void> registerBackgroundCallback(
CompanionDeviceBackgroundCallback callback,
) async {
final callbackHandle = PluginUtilities.getCallbackHandle(callback);
final dispatcherHandle = PluginUtilities.getCallbackHandle(
_backgroundCallbackDispatcher,
);
if (callbackHandle == null || dispatcherHandle == null) {
throw ArgumentError(
'The callback must be a top-level or static function annotated with @pragma(\'vm:entry-point\').',
);
}
await methodChannel.invokeMethod<void>(
'registerBackgroundCallback',
<String, Object?>{
'callbackHandle': callbackHandle.toRawHandle(),
'dispatcherHandle': dispatcherHandle.toRawHandle(),
},
);
}