eventemitter

Dependency free publish/subscribe(pub/sub) for dart&flutter.

How to use

Open the pubspec.yaml file, and add eventemitter: unde dependencies:

  dependencies:
    flutter:
      sdk: flutter
    # ...
    # ...
    eventemitter: ^0.1.3

install it from terminal: Run flutter packages get

Example

String token = EventEmitter.subscribe('topic', (data) {
  // receive 2
  print(data);
});

// publish is async function
EventEmitter.publish('topic', 1)
EventEmitter.publishSync('topic', 2)
EventEmitter.unsubscribe(token);

Libraries

eventemitter