Last active
July 24, 2019 18:37
-
-
Save timrijckaert/14e36cfb56f1103fdb3f79cc9c2a11fe to your computer and use it in GitHub Desktop.
register a callbackdispatcher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void callbackDispatcher() { | |
WidgetsFlutterBinding.ensureInitialized(); | |
print("Our background job ran!"); | |
} | |
void main() { | |
static const MethodChannel _channel = const MethodChannel("channel-name"); | |
Future<void> initialize(final Function callbackDispatcher) async { | |
final callback = PluginUtilities.getCallbackHandle(callbackDispatcher); | |
await _channel.invokeMethod('initialize', callback.toRawHandle()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment