edispatcher 1.0.2

Flutter Android iOS web

A tool class that is convenient for developers to implement event distribution

edispatcher #

event dispatcher

Getting Started #

//event define
abstract class IRandomEvent {}
class RandomNotifyEvent implements IRandomEvent {
  final String random;
  RandomNotifyEvent(this.random);
}

//IRandomEvent event observable
class RandomModel extends EObservable<IRandomEvent> {
  void random() {
    final r = Random().nextInt(0x7FFFFFFF).toString();
    dispatch(RandomNotifyEvent(r));
  }
}

//event subscriber
subscribe<RandomNotifyEvent>(_random, (event) {
      //event dispatched, refresh ui
      setState(() {
        _randomText = event.random;
      });
    });
}

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

0
likes
110
pub points
32%
popularity

Publisher

adeveloper.tech

A tool class that is convenient for developers to implement event distribution

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD (LICENSE)

Dependencies

flutter

More

Packages that depend on edispatcher