error property

Future<AgentError?> error

Gets the current error associated with the Agent, null if there is none.

See also:

Implementation

Future<AgentError?> get error async {
  if (_isolate == null) {
    throw StateError('Agent has been killed.');
  }
  ReceivePort receivePort = ReceivePort();
  _sendPort
      .send(_Command(_Commands.getError, sendPort: receivePort.sendPort));
  dynamic value = await receivePort.first;
  return value as AgentError?;
}