0 purchases
starlight notification
Starlight Notification #
The easiest way to show notification using flutter_local_notifications in flutter.
Features #
☑️ Show Notification
☑️ Cancel Notification
☑️ Cancel All Notification
Watch the video
Installation #
Add starlight_notification as dependency to your pubspec file.
starlight_notification:
git:
url: https://github.com/YeMyoAung/starlight_notification.git
copied to clipboard
Android Setup #
You need to put ic_launcher into app/src/main/res/drawable folder.
Screenshot
add the following attributes to the activity
<activity
android:showWhenLocked="true"
android:turnScreenOn="true">
copied to clipboard
Ios Setup
Add the following lines to the didFinishLaunchingWithOptions method in the AppDelegate.swift file of your iOS project
if #available(iOS 10.0, *) {
UNUserNotificationCenter.current().delegate = self as UNUserNotificationCenterDelegate
}
copied to clipboard
Usage #
First of all you need to import our package.
import 'package:starlight_notification/starlight_notification.dart';
copied to clipboard
Initializing StarlightNotification #
To initialize StarlightNotificationService, call the instance method on the StarlightNotificationService class:
await StarlightNotificationService.setup();
copied to clipboard
you can also pass this callback
await StarlightNotificationService.setup(
onSelectNotification: (e){
///ToDo
}
);
copied to clipboard
And then you can invoke anytime,anywhere when you need.You can also use with firebasemessaging.
Show Notification #
import 'package:flutter/material.dart';
import 'package:starlight_notification/starlight_notification.dart';
Future<void> main() async {
///important
WidgetsFlutterBinding.ensureInitialized();
///important
await StarlightNotificationService.setup(
onSelectNotification: (e){
///ToDo
}
);
///and then you can invoke anytime,anywhere when you need
///you can also use with firebasemessaging
///show notification
await StarlightNotificationService.show(
StarlightNotification(
title: 'hello',
body: 'hi',
payload: '{"name":"mg mg","age":20}',
),
);
}
copied to clipboard
Cancel Notification #
import 'package:flutter/material.dart';
import 'package:starlight_notification/starlight_notification.dart';
Future<void> main() async {
///important
WidgetsFlutterBinding.ensureInitialized();
///important
await StarlightNotificationService.setup(
onSelectNotification: (e){
///ToDo
}
);
///and then you can invoke anytime,anywhere when you need
///you can also use with firebasemessaging
///cancel notification
await StarlightNotificationService.cancel('hello');
}
copied to clipboard
Cancel All Notification #
import 'package:flutter/material.dart';
import 'package:starlight_notification/starlight_notification.dart';
Future<void> main() async {
///important
WidgetsFlutterBinding.ensureInitialized();
///important
await StarlightNotificationService.setup(
onSelectNotification: (e){
///ToDo
}
);
///and then you can invoke anytime,anywhere when you need
///you can also use with firebasemessaging
///cancel all notification
await StarlightNotificationService.cancelAll();
}
copied to clipboard
Contact Us #
Starlight Studio
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.