createFactory<T extends ProtocolChannel> static method

ProtocolFactory createFactory<T extends ProtocolChannel>({
  1. required T channel,
})

Implementation

static ProtocolFactory createFactory<T extends ProtocolChannel>({required T channel}) {
  var used = false;
  return () {
    if (used) {
      throw ProtocolReconnectUnsupportedException('protocolFactory was not configured for reconnecting this protocol');
    }
    used = true;
    return Protocol<T>(channel: channel);
  };
}