updateService method

  1. @override
Future<bool> updateService({
  1. ForegroundTaskOptions? foregroundTaskOptions,
  2. String? notificationTitle,
  3. String? notificationText,
  4. Function? callback,
})
override

Implementation

@override
Future<bool> updateService({
  ForegroundTaskOptions? foregroundTaskOptions,
  String? notificationTitle,
  String? notificationText,
  Function? callback,
}) async {
  if (await isRunningService) {
    final options = <String, dynamic>{
      'notificationContentTitle': notificationTitle,
      'notificationContentText': notificationText,
      if (foregroundTaskOptions != null) ...foregroundTaskOptions.toJson(),
    };
    if (callback != null) {
      options['callbackHandle'] =
          PluginUtilities.getCallbackHandle(callback)?.toRawHandle();
    }
    return await methodChannel.invokeMethod('updateService', options);
  }
  return false;
}