setMockMessageHandler method

  1. @override
void setMockMessageHandler (
  1. String channel,
  2. MessageHandler handler

Set a mock callback for intercepting messages from the send method on this class, on the given channel, without decoding them.

The given callback will replace the currently registered mock callback for that channel, if any. To remove the mock handler, pass null as the handler argument.

The handler's return value, if non-null, is used as a response, unencoded.

This is intended for testing. Messages intercepted in this manner are not sent to platform plugins.


void setMockMessageHandler(String channel, MessageHandler handler) {
  delegate.setMockMessageHandler(channel, handler);