dart_fcm

Creator: coderz1093

Last updated:

0 purchases

dart_fcm Image
dart_fcm Images

Languages

Categories

Add to Cart

Description:

dart fcm

dart_fcm #
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
copied to clipboard
This will add a line like this to your package's pubspec.yaml (and run an implicit dart pub get):
dependencies:
dart_fcm: ^0.1.0
copied to clipboard
Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.
Lastly:
Import it like so:
import 'package:dart_fcm/src/fcm.dart';

copied to clipboard
Usage #
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);

@override
_YourAppNameState createState() => _YourAppNameState();
}

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

@override
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;
}

super.didChangeDependencies();
}

@override
Widget build(BuildContext context) {
return const MaterialApp(
home: Scaffold(
// Your application
),
);
}
}

copied to clipboard
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
License #
This library is distributed under the MIT license found in the LICENSE file.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.