onBackgroundMessage static method

void onBackgroundMessage(
  1. BackgroundMessageHandler handler

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.


// ignore: use_setters_to_change_properties
static void onBackgroundMessage(BackgroundMessageHandler handler) {
  FirebaseMessagingPlatform.onBackgroundMessage = handler;