onBackgroundMessage property

BackgroundMessageHandler? onBackgroundMessage

Set a message handler function which is called when the app is in the background or terminated.

This provided handler must be a top-level function and cannot be anonymous otherwise an ArgumentError will be thrown.

Implementation

static BackgroundMessageHandler? get onBackgroundMessage {
  return _onBackgroundMessageHandler;
}
void onBackgroundMessage=(BackgroundMessageHandler? handler)

Allows the background message handler to be created and calls the instance delegate registerBackgroundMessageHandler to perform any platform specific registration logic.

Implementation

static set onBackgroundMessage(BackgroundMessageHandler? handler) {
  _onBackgroundMessageHandler = handler;

  if (handler != null) {
    instance.registerBackgroundMessageHandler(handler);
  }
}