handle_firebase_notification 1.0.3 copy "handle_firebase_notification: ^1.0.3" to clipboard
handle_firebase_notification: ^1.0.3 copied to clipboard

A flutter plugin to handle firebase notification when app is in Background or Foreground.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:handle_firebase_notification/handle_firebase_notification.dart';
import 'package:handle_firebase_notification/mixin_firebase_notification_state.dart';
import 'package:handle_firebase_notification_example/second_screen.dart';

import 'first_screen.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> with FirebaseNotificationStateMixin {
  @override
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      navigatorObservers: [HandleFirebaseNotification.routeObserver],
      initialRoute: '/',
      routes: <String, WidgetBuilder>{
        "/": (BuildContext context) => FirstScreen(),
        "/second": (BuildContext context) => SecondScreen()
      },
    );
  }

  @override
  void onOpenFromNotification(data, bool isInteracting) {
    print(isInteracting);
  }
}

//class MyApp extends StatelessWidget {
//  @override
//  Widget build(BuildContext context) {
//    return FirebaseNotificationCallbackWidget(
//      onDataReceived: (data) {
//        print(data);
//      },
//      child: MaterialApp(
//        home: Center(
//          child: Text('Hello World'),
//        ),
//      ),
//    );
//  }
//}
3
likes
40
pub points
0%
popularity

Publisher

unverified uploader

A flutter plugin to handle firebase notification when app is in Background or Foreground.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on handle_firebase_notification