A Dart package that provides a simple and easy-to-use solution for handling Firebase Cloud Messaging (FCM) functionality in a Flutter app.


Add djangoflow_fcm as a dependency in your pubspec.yaml file:

  djangoflow_fcm: <latest version>


The package contains a DjangoflowFCMBloc that handles FCM functionality, a DjangoflowFCMRepository that communicates with the Firebase messaging service, and specialized BlocListener classes that can be used to listen for updates to the FCM token and message.

class MyApp extends StatelessWidget {
  Widget build(BuildContext context) {
    return MultiBlocProvider(
      providers: [
          create: (context) => DjangoflowFCMBloc(
      child: MaterialApp(
        home: Scaffold(
          body: DjangoflowFCMBlocMessageListener(
            listener: (context, state) {
              // Do something with the received message
            child: DjangoflowFCMBlocTokenListener(
              listener: (context, state) {
                // Do something with the received token
              child: MyHomePage(),

In the example above, DjangoflowFCMBloc is wrapped in a BlocProvider and provided to the entire app using MultiBlocProvider. The package also includes DjangoflowFCMBlocMessageListener and DjangoflowFCMBlocTokenListener which are used to listen for updates to the FCM message and token, respectively. You can use these classes to handle the received message and token.

Additional Information

DjangoflowFCMBloc contains the following events:

  • DjangoflowFCMTokenRequested
  • DjangoflowFCMInitialMessageRequested
  • DjangoflowFCMOnTokenReceived
  • DjangoflowFCMOnMessageReceived

DjangoflowFCMRepository provides the following methods:

  • getForegroundRemoteMessageStream()
  • getInitialRemoteMessage()
  • getBackgroundRemoteMessageTappedStream()
  • requestNotificationPermission()
  • getToken()
  • getTokenUpdateStream()
  • deleteToken()
  • isSupported()

You can use these events and methods to customize the package as per your requirement.


This package is open for contributions and suggestions. If you find any bug or have any suggestion please open an issue or pull request.


This package is provided under the MIT License.

Thank you for using djangoflow_fcm!