Flutter-NotificationCenter
A lightweight, easy-to-use notification component library that corresponds to Dart supports post notification listening for notifications and notification removal
Content
Installation
dependencies:
notification_center: x.x.x #latest version
Getting started
Add notification_center.dart
to your js file.
import 'package:notification_center/notification_center.dart'
Add observer notification:
NotificationCenter.addObserver(this, 'NotificationName', (param) {
....
});
Post notification:
NotificationCenter.post('NotificationName', 'param value');
Remove specified observer notification:
NotificationCenter.removeObserver(this);
Remove all observer notification:
NotificationCenter.removeObserver(this, 'NotificationName');
API
Method | Type | Optional | Description |
---|---|---|---|
post(string, any) | function | true | post notification |
addObserver(object, string, function) | function | true | observer notification |
removeObserver(object, string) | function | true | remove observer notification |
Contribution
Issues are welcome. Please add a screenshot of bug and code snippet. Quickest way to solve issue is to reproduce it on one of the examples.
Pull requests are welcome. If you want to change API or making something big better to create issue and discuss it first.
MIT Licensed