subscribeOnce static method

dynamic subscribeOnce(
  1. String message,
  2. _Callback cb
)

Implementation

static subscribeOnce(String message, _Callback cb) {
  String token = EventEmitter.subscribe(message, cb);
  // Throw: Concurrent modification
  // -----------------------
  // token = EventEmitter.subscribe(message, (data) {
  //   cb(data);
  //   EventEmitter.unsubscribe(token);
  // });

  onceTokens.putIfAbsent(message, () => []).add(token);
}