decodeMethodCall method Null safety

  1. @override
MethodCall decodeMethodCall(
  1. ByteData? methodCall
)
override

Decodes the specified methodCall from binary.

Implementation

@override
MethodCall decodeMethodCall(ByteData? methodCall) {
  final ReadBuffer buffer = ReadBuffer(methodCall!);
  final Object? method = messageCodec.readValue(buffer);
  final Object? arguments = messageCodec.readValue(buffer);
  if (method is String && !buffer.hasRemaining)
    return MethodCall(method, arguments);
  else
    throw const FormatException('Invalid method call');
}