ChartRegistry class
Global registry of chart types.
This is the single place that maps chart type strings → config
factories. The monolithic getChartConfig switch in helper.dart
is replaced by calls to ChartRegistry.resolve.
- Available extensions
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- count → int
-
Number of registered chart types.
no setter
- generation → int
-
Monotonic version for cache invalidation when registrations change.
no setter
-
registeredEnums
→ List<
ChartType> -
All registered ChartType enum values.
no setter
-
registeredTypes
→ List<
String> -
All currently registered type strings.
no setter
Static Methods
-
clear(
) → void - Clear all registrations (use in tests only).
-
isRegistered(
ChartType type) → bool -
True if
typehas been registered. -
isRegisteredString(
String s) → bool -
True if type string
shas been registered. -
register(
ChartRegistration reg) → void - Register a single chart type.
-
registerAll(
Iterable< ChartRegistration> registrations) → void - Register multiple chart types at once.
-
registrationForString(
String s) → ChartRegistration? -
Registration metadata for type string
s, including aliases. -
registrationForType(
ChartType type) → ChartRegistration? -
Registration metadata for
type, ornullwhen it is not registered. -
resolve(
Map< String, dynamic> json) → BaseChartConfig - Resolve a BaseChartConfig from a JSON map.
-
resolveByType(
ChartType type, Map< String, dynamic> json) → BaseChartConfig - Resolve by ChartType enum (convenience — avoids string lookup).
-
restore(
ChartRegistrySnapshot snapshot) → void -
Restores a previously captured registry
snapshot. -
snapshot(
) → ChartRegistrySnapshot - Captures the current registry state for later restore.
-
suggestTypeStrings(
String rawType, {int limit = 3}) → List< String> -
Suggest registered type strings for a mistyped or unregistered
rawType. -
unregister(
ChartType type) → void - Remove a chart type from the registry (e.g. for testing).
-
withRegistrations<
T> (Iterable< ChartRegistration> registrations, T body(), {bool clearBefore = false}) → T -
Temporarily registers
registrationswhile synchronousbodyruns, then restores the previous registry state even whenbodythrows. -
withRegistrationsAsync<
T> (Iterable< ChartRegistration> registrations, Future<T> body(), {bool clearBefore = false}) → Future<T> - Async variant of withRegistrations.
-
withTag(
String tag) → List< ChartRegistration> - All registrations with a given tag.