subscribe static method

String subscribe(
  1. String message,
  2. _Callback cb
)

Implementation

static String subscribe(String message, _Callback cb) {
  String token = '_token${++lastUid}';

  // if message non exist, add message key to messages;
  messages.putIfAbsent(message, () => {})[token] = cb;
  return token;
}