fcm_push 1.3.1

fcm-push #

A Dart interface to Firebase Cloud Messaging (FCM) for Android and iOS

You can use fcm-push either as commandline tool or you can use it as a library.

Prerequisite #

In your fcm-push.yaml (see below) you need your fcm.server.key and token

For the server.key go to your Firebase console / Settings: Screenshot

For the token check out this Android-Example on GitHub: https://github.com/MikeMitterer/fcm-push-Frontend The token get's logged to the console - see line #39 in MyFirebaseInstanceIDService.java

Command-line #

Activate fcm-push:

pub global activate fcm_push

Create fcm-push.yaml:

fcm.server.key: <your server key>
token: <eithe your phone-ID or a registered subject>

Send your message: fcm-push 'Hello Android' 'Dart rocks!'

Usage: fcm-push <options> title [body]
    -h, --help           Shows this message
    -s, --settings       Prints settings
    -t, --token          subject or token
    -f, --config_file    Change config file
    -v, --loglevel       Sets the appropriate loglevel
                         [info, debug, warning]


    Send message:
        fcm-push 'Hello Android' 'Dart rocks!'

As library #

import 'package:fcm_push/fcm_push.dart';

final String serverKey = "";
final String token = "";

Future<int> main() async {
    final FCM fcm = new FCM(serverKey);
    final Message fcmMessage = new Message()
        ..to = token
        ..title = _config.title
        ..body = _config.body
    final String messageID = await fcm.send(fcmMessage);

License #

Copyright 2018 Michael Mitterer (office@mikemitterer.at),
IT-Consulting and Development Limited, Austrian Branch

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
either express or implied. See the License for the specific language
governing permissions and limitations under the License.

If this plugin is helpful for you - please (Circle) me,
Follow me on Twitter or star this repo here on GitHub.

Change Log for fcm_push #

A Dart interface to Firebase Cloud Messaging (FCM) for Android and iOS

Unreleased #

Refactor #

  • Dart II ready, Link to Android-Fronten added to README b36e25b

v1.3 - 2018-08-24

Feature #

Docs #

  • Adding some infos for server.key and token to README 432b2e2

Refactor #

v1.0.1 - 2017-03-03

Docs #

  • Link to Dash-Button added d3d8041

This CHANGELOG.md was generated with Changelog for Dart

Use this package as an executable

1. Install it

You can install the package from the command line:

$ pub global activate fcm_push

2. Use it

The package has the following executables:

$ fcm-push

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  fcm_push: ^1.3.1

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:

import 'package:fcm_push/fcm_push.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Feb 13, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.5

Health suggestions

Fix lib/fcm_push/fcm.dart. (-8.63 points)

Analysis of lib/fcm_push/fcm.dart reported 18 hints, including:

line 30 col 34: Unnecessary new keyword.

line 35 col 28: Unnecessary new keyword.

line 42 col 13: Unnecessary new keyword.

line 55 col 25: Unnecessary new keyword.

line 75 col 27: Unnecessary new keyword.

Fix lib/cmdline/Application.dart. (-2.96 points)

Analysis of lib/cmdline/Application.dart reported 6 hints, including:

line 4 col 28: Unnecessary new keyword.

line 12 col 32: Unnecessary new keyword.

line 17 col 24: Unnecessary new keyword.

line 58 col 19: Unnecessary new keyword.

line 65 col 25: Unnecessary new keyword.

Fix lib/cmdline/Config.dart. (-2.96 points)

Analysis of lib/cmdline/Config.dart reported 6 hints, including:

line 3 col 1: Prefer using /// for doc comments.

line 9 col 28: Unnecessary new keyword.

line 17 col 43: Unnecessary new keyword.

line 50 col 26: Use isNotEmpty instead of length

line 57 col 45: Unnecessary new keyword.

Fix additional 6 files with analysis or formatting issues. (-7.46 points)

Additional issues in the following files:

  • lib/fcm_push.dart (4 hints)
  • lib/fcm_push/Message.dart (4 hints)
  • bin/fcm-push.dart (3 hints)
  • lib/cmdline.dart (3 hints)
  • lib/cmdline/Options.dart (1 hint)
  • lib/fcm_push/exception.dart (Run dartfmt to format lib/fcm_push/exception.dart.)

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (firebase).

Package is getting outdated. (-47.12 points)

The package was last published 76 weeks ago.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and fcm_push.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
ansicolor ^1.0.0 1.0.2
args ^1.5.0 1.5.2
console_log_handler >=1.1.0 <2.0.0 1.1.6
firebase ^5.0.0 5.0.4 7.2.1
http >=0.11.3 <1.0.0 0.12.0+4
http_utils >=1.6.0 <2.0.0 1.6.3
logging >=0.11.3 <1.0.0 0.11.4
path >=1.6.0 <2.0.0 1.6.4
tuple ^1.0.0 1.0.3
validate ^1.7.0 1.7.0
yaml ^2.1.0 2.2.0
Transitive dependencies
async 2.4.0
charcode 1.1.3
collection 1.14.12
http_parser 3.1.3
intl 0.16.1
js 0.6.1+1
matcher 0.12.6
meta 1.1.8
pedantic 1.9.0
quiver 2.1.2+1
source_span 1.6.0
stack_trace 1.9.3
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.1.6
Dev dependencies
build_runner any
build_test any
build_web_compilers any
test any