encodeErrorEnvelope method

  1. @override
ByteData encodeErrorEnvelope ({@required String code, String message, dynamic details })
override

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.

Implementation

@override
ByteData encodeErrorEnvelope({@required String code, String message, dynamic details}) {
  final WriteBuffer buffer = WriteBuffer();
  buffer.putUint8(1);
  messageCodec.writeValue(buffer, code);
  messageCodec.writeValue(buffer, message);
  messageCodec.writeValue(buffer, details);
  return buffer.done();
}