simple_push_notification

Creator: coderz1093

Last updated:

0 purchases

simple_push_notification Image
simple_push_notification Images

Languages

Categories

Add to Cart

Description:

simple push notification

A simple notification package for handling firebase notifications which supports notification navigations.
Features #

Display push notification
activate and deactivate the push notification service
navigate to desired screen, view or page after tapping to push notification popup

Getting started #
This package uses firebase push notifications and to use this package, firebase app should be configured properly in your flutter app. Recommended way to setup firebase app is using Flutterfire. Follow this doc
In the pubspec.yaml of your flutter project, add the following dependency:
dependencies:
simple_push_notification: latest_version_number
copied to clipboard
import it:
import 'package:simple_push_notification/simple_push_notification.dart';
copied to clipboard
Android #
After configuring firebase, you will see firebase_options.dart created in your lib folder. All you need to do is start a firebase app and use SimplePushNotification class.
void main(){
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
name: NAME_OF_YOUR_FIREBASE_APP,
options: DefaultFirebaseOptions.currentPlatform,
);
runApp(App());
}
copied to clipboard
After the initialization, use SimplePushNotification class anyway you desire.
Usage #
final pushNotification = SimplePushNotification.initialize(
navigatorKey: () => navigatorKey,
getNotificationPayload: (map) => SimplePayload(),
config: NotificationConfig(
appIcon: 'ic_launcher',
notificationChannelDescription: 'this is a test description',
notificationChannelId: 'testId',
notificationChannelName: 'Test name'),
);

await pushNotification.activate(
onActivated: (token) {
log('Notification activated!!!! token: $token');
},
onRead: (payload) {
log(payload.toString());
},
);

copied to clipboard
here, navigatorKey must be provided same as in MaterialApp's navigatorKey or a class that implements NotificationNavigation.
Information #
Please feel free to create PR if you want to contributte.

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.