ILibLoader class
Singleton that loads and caches the bundled locale JSON data.
Call loadJSON once at startup (done automatically by the constructor). After isILibReady becomes true, use getLocaleData and getRootData to read locale data, and loadILibLocaleData when the active locale changes.
- Inheritance
-
- Object
- ChangeNotifier
- ILibLoader
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isILibReady → bool
-
Whether iLib has finished loading and is ready to use.
no setter
- logger → LogAdapter
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
clearCache(
) → void - Clear every cache and reset iLib to not-ready; loadJSON must run again before reading data. For reclaiming all memory and isolating test state. The asset manifest is kept, as it never changes.
-
clearLocale(
String locale) → void -
Drop
locale's merged data to reclaim memory. Safe at runtime: iLib stays ready and the shared file cache is kept, so getLocaleData re-merges it cheaply on next access. -
dispose(
) → void -
Discards any resources used by the object.
inherited
-
getLocaleData(
String locale) → Map< String, dynamic> ? -
The merged locale data for
locale, or null iflocalehas not been loaded. Data is resolved lazily from the file cache on first access. -
getRootData(
) → Map< String, dynamic> ? -
Locale-independent data from root.json (e.g.
ilib.data.astro). -
initILib(
) → void - Mark iLib as ready once locale data has been loaded.
-
loadILibLocaleData(
String? locale) → Future< void> -
Load and cache the JSON data for
locale, notifying listeners only if it differs from the last loaded locale (reloading the same one is a no-op for listeners). Pass null to reload the current locale. No-op if not ready. -
loadILibLocaleDataAll(
) → Future< void> -
Load and cache JSON data for every locale in
getSupportedLocales. -
loadJSON(
) → Future< void> - Load the bundled JSON data for the current locale.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → ILibLoader
-
The singleton instance.
no setter