notification_center 0.0.3 copy "notification_center: ^0.0.3" to clipboard
notification_center: ^0.0.3 copied to clipboard

A simple notification center. A notification dispatch mechanism that enables the broadcast of information to registered observers.

Notification Center #

Pub Version

A notification dispatch mechanism that enables the broadcast of information to registered observers.

Getting Started #

notification_center is available through pub.dev.

Add the dependency to your pubspec.yaml:

dependencies:
  ...
  notification_center: ^0.0.3

Usage example #

Check the example folder

Subscribe observer

NotificationCenter().subscribe('updateCounter', () {
  setState(() {
    _counter++;
  });
});

or

NotificationCenter().subscribe('updateCounter', _updateCounter);

...

void _updateCounter() {
  setState(() {
    _counter++;
  });
}

Unsubscribe observer

NotificationCenter().unsubscribe('updateCounter');

Post notification

NotificationCenter().notify('updateCounter');

Passing data

NotificationCenter().subscribe('updateCounter', (int value) {
  setState(() {
    _counter = value;
  });
});
NotificationCenter().notify('updateCounter', data: 10);
11
likes
160
pub points
93%
popularity

Publisher

verified publisheraky.dev

A simple notification center. A notification dispatch mechanism that enables the broadcast of information to registered observers.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on notification_center