0 purchases
cobi flutter service
CobiFlutterService plugin #
This executes dart code in a second isolate while providing communication between the main and background isolates.
It also integrates with the device's status bar.
This plugin is currently only available for Android.
Usage #
To use this plugin, add cobi_flutter_service as a dependency in your pubspec.yaml file.
Then implement a runner function:
void serviceRunner(SendPort sendPort, ReceivePort receivePort) {
print("Service runner executed");
}
copied to clipboard
To prepare your app to run the background service, initialize it:
void main() {
WidgetsFlutterBinding.ensureInitialized();
CobiFlutterService.instance.initService(serviceRunner, true);
runApp(MyApp());
}
copied to clipboard
Then you can start the service by calling
CobiFlutterService.instance.startService();
copied to clipboard
For a more advanced use case, see the included example
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.