flutter_fit_events 1.0.3 copy "flutter_fit_events: ^1.0.3" to clipboard
flutter_fit_events: ^1.0.3 copied to clipboard

A flutter package that handles listening and publishing events throughout your app.

A flutter package that handles listening and publishing events throughout your app, with the observer pattern.

Features #

  • Publish events
  • Listen to all events
  • Listen to specific types of events

Getting started #

  • Go inside your pubspec.yaml file
  • Add this line under the dependencies:
flutter_fit_events: ^1.0.3
  • Get dependencies
flutter pub get

Usage #

First, AppEventsDispatcher is a Singleton, so you can use it easily everywhere.

  1. Send an event for dispatch with AppEventsDispatcher().publish(event)
  2. Listen to all events with AppEventsDispatcher().stream.listen((AppEvent event) {})
  3. Listen to a specific type of event with AppEventsDispatcher().listenTo<AppEventType>((AppEvent event) {})

You can create your own events by extending the AppEvent class. For signaling errors, you can directly use the ErrorEvent class or extend it to create your own error event.

Additional information #

Inspired from this article. Feel free to give any feedback ! This package is also open to contributions.

4
likes
140
points
177
downloads

Publisher

unverified uploader

Weekly Downloads

A flutter package that handles listening and publishing events throughout your app.

Homepage
Repository (GitHub)
View/report issues

Topics

#events #dispatcher #observer

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_fit_events