run<R> method

  1. @visibleForTesting
R run<R>(
  1. R testCode()
)

Runs testCode with this object as Platform.current.browserPlatform.

While testCode is running, the Platform.browserPlatform of Platform.current refers to this TestBrowserPlatform.

Prior reads of Platform.current will retain their original value, so the testCode should make sure to read Platform.current when it's needed, and not rely on previously read values.

Implementation

@visibleForTesting
R run<R>(R Function() testCode) => overrides.runWith(
  testCode,
  TestPlatform._browser(this),
  _OverrideMarker.marker,
);