ConvertConfig.overrides constructor
ConvertConfig.overrides({
- String? locale,
- bool clearLocale = false,
- NumberOptions? numbers,
- DateOptions? dates,
- BoolOptions? bools,
- UriOptions? uri,
- TypeRegistry? registry,
- ExceptionHook? onException,
- bool clearOnException = false,
Creates a config intended for scoped overrides.
Provide only the fields you want to override; unset fields keep the current effective values when merged in runScoped.
Implementation
factory ConvertConfig.overrides({
String? locale,
bool clearLocale = false,
NumberOptions? numbers,
DateOptions? dates,
BoolOptions? bools,
UriOptions? uri,
TypeRegistry? registry,
ExceptionHook? onException,
bool clearOnException = false,
}) {
var mask = 0;
String? effectiveLocale;
if (locale != null || clearLocale) {
mask |= _overrideLocale;
effectiveLocale = clearLocale ? null : locale;
}
if (numbers != null) mask |= _overrideNumbers;
if (dates != null) mask |= _overrideDates;
if (bools != null) mask |= _overrideBools;
if (uri != null) mask |= _overrideUri;
if (registry != null) mask |= _overrideRegistry;
if (onException != null || clearOnException) {
mask |= _overrideOnException;
}
return ConvertConfig._override(
locale: effectiveLocale,
numbers: numbers ?? const NumberOptions(),
dates: dates ?? const DateOptions(),
bools: bools ?? const BoolOptions(),
uri: uri ?? const UriOptions(),
registry: registry ?? const TypeRegistry.empty(),
onException: clearOnException ? null : onException,
overrideMask: mask,
);
}