robusta_events 0.2.1 copy "robusta_events: ^0.2.1" to clipboard
robusta_events: ^0.2.1 copied to clipboard

Add custom hook (event) to domain-specific for extending.

Robusta Events #

Library help to add custom hook (event) to domain-specific for extending logic.

Installing #

Install this package via pub command:

dart pub get robusta_events

Usages #

Create an event manager, add event listener and dispatch on domain-specific:

import 'package:robusta_events/robusta_events.dart';

/// Test event
class TestEvent extends Event {
  /// Will be increase when this event dispatch.
  int counter = 0;
}

/// Event manager manage the event system.
final eventManager = DefaultEventManager()
  ..addEventListener(
    (TestEvent event) => event.counter++,
  );

void main() {
  final event = TestEvent();

  eventManager.dispatchEvent(event);

  print(event.counter);
}
2
likes
120
pub points
4%
popularity

Publisher

unverified uploader

Add custom hook (event) to domain-specific for extending.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

logger

More

Packages that depend on robusta_events