Open Samson11 opened 3 years ago
When you start periodic task with startPeriodicTask
you must pass a top-level function to the parameter periodicTaskFun
.
Top-level function : A function defined outside of any class, object, or interface.
Convert your function to static and it will work
When i try to use the example to change notification content. I get this error.
E/flutter (21734): [ERROR:flutter/lib/ui/ui_dart_state.cc(177)] Unhandled Exception: NoSuchMethodError: The method 'toRawHandle' was called on null.
E/flutter (21734): Tried calling: toRawHandle() E/flutter (21734): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:51:5) E/flutter (21734): #1 FlutterForegroundServicePlugin.startPeriodicTask (package:flutter_foreground_service_plugin/flutter_foreground_service_plugin.dart:162:60)