encodeErrorEnvelope method

  1. @override
ByteData encodeErrorEnvelope(
  1. {required String code,
  2. String? message,
  3. Object? details}

Encodes an error result into a binary envelope.

The specified error code, human-readable error message and error details correspond to the fields of PlatformException.


ByteData encodeErrorEnvelope({ required String code, String? message, Object? details}) {
  final WriteBuffer buffer = WriteBuffer(startCapacity: _writeBufferStartCapacity);
  messageCodec.writeValue(buffer, code);
  messageCodec.writeValue(buffer, message);
  messageCodec.writeValue(buffer, details);
  return buffer.done();