fcm_push 1.3.1

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 74

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]

Sample:

    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

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
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

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:


dependencies:
  fcm_push: ^1.3.1

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages 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';
  
Version Uploaded Documentation Archive
1.3.1 Aug 24, 2018 Go to the documentation of fcm_push 1.3.1 Download fcm_push 1.3.1 archive
1.2.7 Aug 23, 2018 Go to the documentation of fcm_push 1.2.7 Download fcm_push 1.2.7 archive
1.2.5 Jun 4, 2018 Go to the documentation of fcm_push 1.2.5 Download fcm_push 1.2.5 archive
1.2.3 Jun 4, 2018 Go to the documentation of fcm_push 1.2.3 Download fcm_push 1.2.3 archive
1.2.1 Jun 4, 2018 Go to the documentation of fcm_push 1.2.1 Download fcm_push 1.2.1 archive
1.1.9 Dec 7, 2017 Go to the documentation of fcm_push 1.1.9 Download fcm_push 1.1.9 archive
1.1.7 Dec 7, 2017 Go to the documentation of fcm_push 1.1.7 Download fcm_push 1.1.7 archive
1.0.1 Mar 3, 2017 Go to the documentation of fcm_push 1.0.1 Download fcm_push 1.0.1 archive
1.0.0 Mar 3, 2017 Go to the documentation of fcm_push 1.0.0 Download fcm_push 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
53
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
74
Learn more about scoring.

We analyzed this package on Oct 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.4

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:fcm_push/fcm_push.dart.

Health suggestions

Fix lib/cmdline.dart. (-0.50 points)

Analysis of lib/cmdline.dart reported 1 hint:

line 42 col 15: The top level variable '_penError' isn't used.

Fix lib/fcm_push.dart. (-0.50 points)

Analysis of lib/fcm_push.dart reported 1 hint:

line 43 col 15: The top level variable '_penGreen' isn't used.

Format bin/fcm-push.dart.

Run dartfmt to format bin/fcm-push.dart.

Fix additional 6 files with analysis or formatting issues.

Additional issues in the following files:

  • lib/cmdline/Application.dart (Run dartfmt to format lib/cmdline/Application.dart.)
  • lib/cmdline/Config.dart (Run dartfmt to format lib/cmdline/Config.dart.)
  • lib/cmdline/Options.dart (Run dartfmt to format lib/cmdline/Options.dart.)
  • lib/fcm_push/Message.dart (Run dartfmt to format lib/fcm_push/Message.dart.)
  • lib/fcm_push/exception.dart (Run dartfmt to format lib/fcm_push/exception.dart.)
  • lib/fcm_push/fcm.dart (Run dartfmt to format lib/fcm_push/fcm.dart.)

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use fcm_push.dart.

Dependencies

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.0
console_log_handler >=1.1.0 <2.0.0 1.1.3
firebase ^5.0.0 5.0.2
http >=0.11.3 <1.0.0 0.11.3+17 0.12.0
http_utils >=1.6.0 <2.0.0 1.6.3
logging >=0.11.3 <1.0.0 0.11.3+2
path >=1.6.0 <2.0.0 1.6.2
tuple ^1.0.0 1.0.2
validate ^1.7.0 1.7.0
yaml ^2.1.0 2.1.15
Transitive dependencies
async 2.0.8
charcode 1.1.2
collection 1.14.11
http_parser 3.1.3
intl 0.15.7
js 0.6.1+1
matcher 0.12.4
meta 1.1.6
quiver 2.0.0+1
source_span 1.4.1
stack_trace 1.9.3
string_scanner 1.0.4
typed_data 1.1.6
Dev dependencies
build_runner any
build_test any
build_web_compilers any
test any