MapxusBackgroundHandler typedef
MapxusBackgroundHandler =
Future<void> Function(MapxusEvent event)
Signature for the function called by the foreground service when a positioning event arrives and the app is closed.
The function must be a top-level function (not a method or closure)
and should be annotated with @pragma('vm:entry-point') to prevent the
Dart compiler from tree-shaking it in release builds.
Example:
@pragma('vm:entry-point')
Future<void> onBackgroundLocation(MapxusEvent event) async {
if (event is MapxusLocationEvent) {
await MyApi.upload(event.latitude, event.longitude);
}
}
Implementation
typedef MapxusBackgroundHandler = Future<void> Function(MapxusEvent event);