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

outdated

A starting point for Dart libraries or applications.

example/event_taxi_example.dart

import 'package:event_taxi/event_taxi.dart';
import 'package:event_taxi/src/event.dart';

class TextEvent implements Event {

  /// The [Event] class is immutable, that means that all properties must be final
  final int textCounter;

  TextEvent(this.textCounter);
}


main() {
  // This is a ui page
  iAmAPage();

  // This is another ui page
  iAmAnotherPage();
}


void iAmAPage(){

  EventTaxi eventBus = EventTaxiImpl();

  eventBus.registerTo<TextEvent>().listen((textEvent){
    // Now you have event
  });
}

void iAmAnotherPage(){
  EventTaxi eventTaxi = EventTaxiImpl();

  // We send the event through the eventBus
  eventTaxi.fire(TextEvent(22));
}
7
likes
0
pub points
82%
popularity

Publisher

unverified uploader

A starting point for Dart libraries or applications.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

meta

More

Packages that depend on event_taxi