Register a callback for receiving JSON messages from the host application.
Messages received from the host application are decoded as JSON before
being passed to callback. The result of the callback is encoded as JSON
before being returned to the host application.
Source
static void addJSONMessageHandler(String channel, Future<dynamic> callback(dynamic json)) {
PlatformMessages.setJSONMessageHandler(channel, callback);
}