allocate static method

int allocate(
  1. void handler(
    1. dynamic raw
    )
)

Registers handler and returns its port id.

Implementation

static int allocate(void Function(dynamic raw) handler) {
  final id = _nextId++;
  _handlers[id] = handler;
  return id;
}