Registry<T>.fromPort constructor

Registry<T>.fromPort(
  1. SendPort commandPort, {
  2. Duration timeout = const Duration(seconds: 5),
})

Create a registry linked to a RegistryManager through commandPort.

In most cases, a registry is created by using the RegistryManager.registry getter.

If a registry is used between isolates created using Isolate.spawnUri, the Registry object can't be sent between the isolates directly. Instead the RegistryManager.commandPort port can be sent and a Registry created from the command port using this constructor.

The optional timeout parameter can be set to the duration this registry should wait before assuming that an operation has failed.

Implementation

Registry.fromPort(SendPort commandPort,
    {Duration timeout = const Duration(seconds: 5)})
    : _commandPort = commandPort,
      _timeout = timeout;