typed_bus 0.0.6 copy "typed_bus: ^0.0.6" to clipboard
typed_bus: ^0.0.6 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
32
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

BSD-3-Clause (license)

More

Packages that depend on typed_bus