run<R> method

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

Runs testCode with this native platform as current native platform.

While testCode is running, the Platform.current refers a new TestPlatform with this native platform as Platform.nativePlatform.

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._native(this),
  _OverrideMarker.marker,
);