Release Maintained


dart_fcm is an open source project — it's one among many other shared libraries that make up the wider ecosystem of software made and open sourced by Savannah Informatics Limited.

dart_fcm is a wrapper package for setting up and consuming cloud notifications from firebase

Installation Instructions

Use this package as a library by depending on it

Run this command:

  • With Flutter:
$ flutter pub add dart_fcm

This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):

  dart_fcm: ^0.1.0

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.


Import it like so:

import 'package:dart_fcm/src/fcm.dart';


Lets take a look at how to hook-up your application to use dart_fcm.

import 'package:dart_fcm/dart_fcm.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const YourAppName());

/// [YourAppName] marks as the entry point to your application.
class YourAppName extends StatefulWidget {
  const YourAppName({Key? key}) : super(key: key);

  _YourAppNameState createState() => _YourAppNameState();

class _YourAppNameState extends State<YourAppName> {
  bool hasFinishedLaunching = false;

  void didChangeDependencies() {
    if (!hasFinishedLaunching) {
      /// [configure] is responsible for correctly setting
      /// up local notifications ( and asking for permission if needed) and wiring-up
      /// firebase messaging [onMessage] callback to show fcm messages
      SILFCM().configure(context: context);
      hasFinishedLaunching = true;


  Widget build(BuildContext context) {
    return const MaterialApp(
      home: Scaffold(
          // Your application

With the above snippet, we have successfully hooked up our application to use dart_fcm. You have now bootstraped local notifications to your application for Android, iOS and macOS settings. This will create notification channels and prompt the user for notification permissions. Your application has now enabled foreground notifications so that they can be visible while the app is in the foreground

Provided here is a more detailed snippet, on how to use the package.

Dart & Flutter Version

  • Dart 2: >= 2.12
  • Flutter: >=2.0.0

Developing & Contributing

First off, thanks for taking the time to contribute!

Be sure to check out detailed instructions on how to contribute to this project here and go through out Code of Conduct.

GPG Signing: As a contributor, you need to sign your commits. For more details check here


This library is distributed under the MIT license found in the LICENSE file.