decodeMethodCall method

  1. @override
MethodCall decodeMethodCall (ByteData methodCall)
override

Decodes the specified methodCall from binary.

Implementation

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