withOverrides<R> static method
Runs body with overrides in force for it and for nothing else.
Zone-scoped, so an override follows the callback across awaits and a test's flags never leak into the next test. Ignored in a release build.
Implementation
static Future<R> withOverrides<R>(
Map<String, Object?> overrides,
Future<R> Function() body,
) {
final Map<String, Object?> merged = <String, Object?>{
..._currentOverrides(),
...overrides,
};
return runZoned(body, zoneValues: <Object?, Object?>{
_zoneOverrides: merged,
});
}