notification_dispatcher 0.1.0 copy "notification_dispatcher: ^0.1.0" to clipboard
notification_dispatcher: ^0.1.0 copied to clipboard

Passes information around to registered observers.

example/notification_dispatcher_example.dart

import 'package:notification_dispatcher/notification_dispatcher.dart';

class YourClass {
  int count = 0;

  void init() {
    NotificationDispatcher.instance.addObserver(
      this,
      name: 'observerName',
      callback: (_) => count++,
    );
  }

  void dispose() {
    NotificationDispatcher.instance.removeObserver(YourClass);
  }
}

void main() {
  final yourClass = YourClass()..init();
  NotificationDispatcher.instance.post(name: 'observerName');

  print(yourClass.count); // 1
  yourClass.dispose();
}
5
likes
0
points
75
downloads

Publisher

unverified uploader

Weekly Downloads

Passes information around to registered observers.

Repository (GitHub)
View/report issues

License

unknown (license)

More

Packages that depend on notification_dispatcher