typed_bus 1.0.0 copy "typed_bus: ^1.0.0" to clipboard
typed_bus: ^1.0.0 copied to clipboard

Typed Event Bus to share events on a bus and be sure of payload

example/lib/main.dart

import 'package:typed_bus/typed_bus.dart';

class TodoItem {
  String description;
  bool isDone;

  TodoItem({required this.description, required this.isDone});

  @override
  String toString() {
    return 'TodoItem(description: $description, isDone: $isDone)';
  }
}

void main() {
  tBE.registerEvent<TodoItem>("toggle");

  tB.subscribe<TodoItem>('toggle').listen((TodoItem item) {
    item.isDone = true;

    print(item);
  });

  tB.publish<TodoItem>(
      'toggle', TodoItem(description: "Publish Toggle Event", isDone: false));
}
2
likes
160
points
389
downloads

Publisher

verified publishermatserdam.amsterdam

Weekly Downloads

Typed Event Bus to share events on a bus and be sure of payload

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

More

Packages that depend on typed_bus