checkMockMessageHandler method

bool checkMockMessageHandler(
  1. String channel,
  2. Object? handler

Returns true if the handler argument matches the handler previously passed to setMockMessageHandler, setMockDecodedMessageHandler, or setMockMethodCallHandler.

Specifically, it compares the argument provided to the identity argument provided to setMockMessageHandler, defaulting to the handler argument passed to that method is identity was null.

This method is useful for tests or test harnesses that want to assert the mock handler for the specified channel has not been altered by a previous test.

Passing null for the handler returns true if the handler for the channel is not set.

Registered callbacks are cleared after each test.


bool checkMockMessageHandler(String channel, Object? handler) => _outboundHandlerIdentities[channel] == handler;