install static method

void install({
  1. bool fallThrough = false,
})

Install mocking logic & controls for all transports. This will effectively wrap all BaseRequest, HttpClient, and WebSocket instances in a mocking layer. Expectations and handlers can be registered via the MockTransports API.

If fallThrough is true, any HTTP request that is sent and any WebSocket that is opened will fall through to the configured TransportPlatform if a mock expectation or handler is not set up to handle it. This enables selective mocking - certain requests or WebSockets can be mocked while the rest will be handled by a real transport platform.

Implementation

static void install({bool fallThrough = false}) {
  MockTransportsInternal.isInstalled = true;
  MockTransportsInternal.fallThrough = fallThrough;
}