receiveMethodResponse method
void
receiveMethodResponse(
- String message
)
Implementation
void receiveMethodResponse(String message) {
Logger.debug('MPJS: receiveMethodResponse => $message');
try {
final obj = json.decode(message);
if (obj is Map) {
final id = obj["id"];
final method = obj["method"];
if (id is String && _invokeMethodCompleters[id] != null) {
if (obj["error"] != null) {
_invokeMethodCompleters[id]?.completeError(obj["error"]);
return;
}
_invokeMethodCompleters[id]?.complete(obj["result"]);
} else if (method is String) {
eventListenner?.call(method, obj["params"]);
}
}
} catch (e) {}
}