runWithStyleOverride<T> static method
Executes action with a temporary style override.
This is intended for tests and low-level framework wiring where a widget subtree is not the right tool.
Implementation
static Future<T> runWithStyleOverride<T>(
DraftModePlatformStyle style,
FutureOr<T> Function() action,
) async {
final DraftModePlatformStyle? previous = _debugStyleOverride;
_debugStyleOverride = style;
try {
return await action();
} finally {
_debugStyleOverride = previous;
}
}