handleBackground static method
void
handleBackground()
Registers the top-level background message handler.
Call this from main() BEFORE runApp() and BEFORE
Firebase.initializeApp().
void main() async {
WidgetsFlutterBinding.ensureInitialized();
PushHandler.handleBackground();
await Firebase.initializeApp();
runApp(const MyApp());
}
Implementation
static void handleBackground() {
FirebaseMessaging.onBackgroundMessage(_firebaseBackgroundHandler);
}