record method

Future<PeerRecord> record()

Returns the Envelope's payload unmarshalled as a RecordBase. The concrete type of the returned RecordBase depends on which RecordBase type was registered for the Envelope's payloadType.

Implementation

Future<pb.PeerRecord> record() async {
  if (!_unmarshalled) {
    try {
      _cached = await RecordRegistry.unmarshal(payloadType, rawPayload);
    } catch (e) {
      _unmarshalError = e as Exception;
    }
    _unmarshalled = true;
  }
  if (_unmarshalError != null) {
    throw _unmarshalError!;
  }
  return _cached!;
}