Sets a message handler that intercepts outgoing messages in JSON form.
The given callback will replace the currently registered callback (if any).
To remove the mock handler, pass null
as the handler
argument.
Source
static void setMockJSONMessageHandler(String channel, Future<dynamic> handler(dynamic message)) { setMockStringMessageHandler(channel, (String message) async { return _encodeJSON(await handler(_decodeJSON(message))); }); }