debugForceFallbacks property
When true, shouldUseNativeControls and shouldUseNativeGlass are false, so every widget takes its Flutter fallback on any host.
flutter test runs on the host machine. On a Mac, Platform.isMacOS
is true, so a widget test that targets iOS still gets the native views
(macOS draws its standard controls natively on every version), while
the same test on Linux CI gets the fallbacks. Set this in a test that
checks a fallback, and reset it afterwards:
PlatformVersion.debugForceFallbacks = true;
addTearDown(PlatformVersion.reset);
Implementation
@visibleForTesting
static bool debugForceFallbacks = false;