BloomModuleRegistry class
Central singleton registry managing the lifecycle, registration, and discovery of Bloom Native Modules.
Modules register on startup or on demand, and automatically receive application lifecycle notifications (BloomLifecycleEvent.resumed, BloomLifecycleEvent.paused) dispatched by the host.
Example:
final registry = BloomModuleRegistry();
await registry.registerModule(myCameraModule);
final camera = registry.getModule<CameraModule>('BloomCamera');
Constructors
- BloomModuleRegistry()
-
Returns the singleton BloomModuleRegistry instance.
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- moduleCount → int
-
Total number of active registered modules in this registry.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
dispatchLifecycle(
BloomLifecycleEvent event) → void -
Forwards an application lifecycle transition
eventto all registered native modules. -
dumpRegistry(
) → Map< String, dynamic> - Dumps metadata of all registered modules for DevTools and diagnostics.
-
getAllModules(
) → List< BloomNativeModule> - Returns an unmodifiable list of all currently active registered modules.
-
getModule<
T extends BloomNativeModule> (String name) → T -
Retrieves a registered module by
name, or throws StateError if missing. -
getModuleOrNull<
T extends BloomNativeModule> (String name) → T? -
Retrieves an optional registered module by
name, returningnullif not registered. -
hasModule(
String name) → bool -
Checks whether a module identified by
nameis currently registered. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerModule(
BloomNativeModule module) → Future< void> -
Registers a native
moduleand executes its asynchronous BloomNativeModule.onInit lifecycle hook. -
reset(
) → Future< void> - Completely clears and resets all registered modules, awaiting BloomNativeModule.onDispose on each.
-
resetSync(
) → void - Synchronously resets all registered modules and triggers asynchronous background disposal.
-
toString(
) → String -
A string representation of this object.
inherited
-
unregisterModule(
String name) → Future< void> -
Unregisters and disposes a native module identified by
name, invoking BloomNativeModule.onDispose.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited