decodeMethodCall method
- 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');
}
final Object? method = decoded['method'];
final Object? arguments = decoded['args'];
if (method is String) {
return MethodCall(method, arguments);
}
throw FormatException('Invalid method call: $decoded');
}