JsonWidgetRegistry constructor
JsonWidgetRegistry({
- Map<
String, JsonWidgetBuilderContainer> ? builders, - bool overrideInternalBuilders = false,
- String? debugLabel,
- bool disableValidation = false,
- Map<
String, JsonWidgetFunction> ? functions, - bool overrideInternalFunctions = false,
- JsonWidgetRegistry? parent,
- List<
ArgProcessor> ? argProcessors, - Map<
String, dynamic> ? values,
Constructs a one-off registry. This accepts an optional group of custom
widget builders, custom widget functions, and widget values.
It allows to extend the default syntax with custom one by passing
argProcessors.
Implementation
JsonWidgetRegistry({
Map<String, JsonWidgetBuilderContainer>? builders,
bool overrideInternalBuilders = false,
String? debugLabel,
this.disableValidation = false,
Map<String, JsonWidgetFunction>? functions,
bool overrideInternalFunctions = false,
this.navigatorKey,
JsonWidgetRegistry? parent,
List<ArgProcessor>? argProcessors,
Map<String, dynamic>? values,
}) : debugLabel = (parent != null ? '${parent.debugLabel}.' : '') +
(debugLabel ?? 'child_${++childCount}'),
_parent = parent {
_logger = Logger('REGISTRY ${this.debugLabel}');
_builders.addAll({
if (!overrideInternalBuilders) ...JsonWidgetInternalBuilders.defaults(),
if (builders != null) ...builders
});
_functions.addAll({
if (!overrideInternalFunctions) ...JsonWidgetInternalFunctions.defaults(),
if (functions != null) ...functions
});
_values.addAll(values ?? {});
_parentDisposeStreamSubscription =
parent?.disposeStream.listen((_) => dispose());
_argProcessors = argProcessors ?? ArgProcessors.defaults;
_parentValueStreamSubscription = parent?.valueStream
.listen((event) => _valueStreamController?.add(event));
}