WidgetRegistry class

Registry for widget builders

Each SchemaParser creates its own registry instance to ensure proper callback binding. Use WidgetRegistry.global only when you need app-wide widget registration (rare).

Example:

// Recommended: Let SchemaParser create its own registry
final parser = SchemaParser(onCustomAction: myHandler);

// Advanced: Share registry across parsers
final sharedRegistry = WidgetRegistry();
final parser1 = SchemaParser(registry: sharedRegistry);
final parser2 = SchemaParser(registry: sharedRegistry);

Constructors

WidgetRegistry()
Creates a new isolated registry instance.
factory

Properties

customErrorBuilder Widget Function(String type, String error)?
Custom error widget builder for build errors
getter/setter pair
customFallbackBuilder Widget Function(WidgetSchema schema)?
Custom fallback widget builder for unknown types
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
registeredTypes List<String>
Get all registered types
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build(WidgetSchema schema, BuildContext context) Widget
Build a widget from schema
clear() → void
Clear all builders
hasBuilder(String type) bool
Check if type is registered
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
register(String type, WidgetBuilder builder) → void
Register a widget builder
registerAll(Map<String, WidgetBuilder> builders) → void
Register multiple widget builders
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

instance WidgetRegistry
Singleton instance for app-wide widget registration.
final