event_dart 2.0.1 icon indicating copy to clipboard operation
event_dart: ^2.0.1 copied to clipboard

Simple, complete and intuitive event emitter written in Dart

example/example.dart

import 'package:event_dart/event_dart.dart';

class Restaurant with EventEmitter {
  Future makeFood() async {
    emit('burger');
    Future.delayed(Duration(seconds: 5), () => emit('pizza'));
    Future.delayed(Duration(seconds: 10), () => emit('icecream'));
  }
}

void main() {
  final restaurant = Restaurant();

  restaurant.on('burger', () => print('Pretty good.'));
  restaurant.on('pizza', () => print('Tasty.'));
  restaurant.on('icecream', () => print('Too cold!'));

  restaurant.makeFood();
}
1
likes
140
pub points
52%
popularity

Publisher

unverified uploader

Simple, complete and intuitive event emitter written in Dart

Repository (GitHub)
View/report issues

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

More

Packages that depend on event_dart