update static method
Update foreground task.
Implementation
static Future<void> update({
String? notificationTitle,
String? notificationText,
Function? callback,
}) async {
// If the task is not running, the update function is not executed.
if (!await isRunningTask) return;
final options = Map<String, dynamic>();
options['notificationContentTitle'] = notificationTitle;
options['notificationContentText'] = notificationText;
if (callback != null) {
options['callbackHandle'] =
PluginUtilities.getCallbackHandle(callback)?.toRawHandle();
}
_methodChannel.invokeMethod('updateForegroundService', options);
_printMessage('FlutterForegroundTask updated.');
}