CobiFlutterService class

Properties

hashCode int
The hash code for this object.
no setterinherited
onDataReceived Stream
Listeners get data from the background isolate
no setter
onServiceStateChanged Stream<bool?>
Listeners are informed when the service changes its state (running or not)
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

executeAction(String action) Future<bool?>
This executes actions on the backgroudn isolate. Note: the action's name does not have to correspond to action names given to the notification.
getAutostartOnBoot() Future<bool>
This reports whether or not the service is to be started at boot
getForegroundMode() Future<bool?>
initService(CobiFlutterServiceCallback callback, [bool autostartOnBoot = false]) Future<void>
Call this first. If you don't, your service will not work. The callback's receivePort will receive the message 'stop' when the service is to be stopped. It should send 'stopped' via its sendPort once the work is finished. It can also send 'not stopped' in order to keep working. If it does not do so within 5 seconds, the service will be stopped forcefully
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sendData(dynamic data) Future<bool?>
This method sends data to the background isolate If you want to send data from the background isolate to the UI isolate, please see the included example app
setAutostartOnBoot(dynamic value) Future<bool>
This sets a boolean via SharedPreferences whether or not to start the service on device boot. The value can be changed from the app using the key 'autostartOnBoot' via the SharedPreferences plugin.
setForegroundMode(bool foreground) Future<bool?>
setNotificationData(CobiNotificationData data) Future<bool?>
This sets the notification data that is displayed in the device's status bar
startService() Future<bool?>
This starts the service
stopService() Future<bool?>
This stops the service on the platform side when the background isolate reports that it's done cleaning up. Please see the included example.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance CobiFlutterService
no setter