FlutterForegroundTask class

A class that implement foreground task and provide useful utilities.

Constructors

FlutterForegroundTask()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Properties

isIgnoringBatteryOptimizations Future<bool>
Returns whether the app has been excluded from battery optimization.
no setter
isRunningTask Future<bool>
Returns whether the foreground task is running.
no setter

Static Methods

init({required AndroidNotificationOptions androidNotificationOptions, required IOSNotificationOptions iosNotificationOptions, ForegroundTaskOptions? foregroundTaskOptions, bool? printDevLog}) Future<void>
Initialize the FlutterForegroundTask.
initDispatcher(TaskCallback taskCallback, {DestroyCallback? onDestroy}) → void
Initialize Dispatcher to relay events occurring in the foreground service to taskCallback. It must always be called from a top-level function, otherwise foreground tasks will not work.
minimizeApp() → void
Minimize the app to the background.
openIgnoreBatteryOptimizationSettings() Future<bool>
Open the settings page where you can set ignore battery optimization.
start({required String notificationTitle, required String notificationText, Function? callback}) Future<ReceivePort?>
Start foreground task with notification.
stop() Future<void>
Stop foreground task.
update({String? notificationTitle, String? notificationText, Function? callback}) Future<void>
Update foreground task.
wakeUpScreen() → void
Wake up the screen of a device that is turned off.