decodeMethodCall method

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

Decodes the specified methodCall from binary.

Implementation

@override
MethodCall decodeMethodCall(ByteData? methodCall) {
  final Object? decoded = const JSONMessageCodec().decodeMessage(methodCall);
  if (decoded is! Map) {
    throw FormatException('Expected method call Map, got $decoded');
  }
  if (decoded case {'method': final String method}) {
    return MethodCall(method, decoded['args']);
  }
  throw FormatException('Invalid method call: $decoded');
}