NiceModuleLoader class

Manages lazy loading, initialization, delta updates, and rollback of ERP modules.

Usage:

final loader = NiceModuleLoader(
  viewService: myViewService,
  featureFlags: myFlagManager,
);

// Register module initializers (typically from deferred imports)
loader.registerModule('inventory', () async {
  // Initialize inventory module: register components, etc.
  NiceViewRegistry.instance.register(NiceViewComponentType.dataGrid, ...);
});

// Load module on demand
await loader.loadModule('inventory');

Constructors

NiceModuleLoader({NiceViewService? viewService, NiceFeatureFlagManager? featureFlags, NiceViewCacheStorage? cacheStorage})

Properties

cacheStorage NiceViewCacheStorage?
final
featureFlags NiceFeatureFlagManager?
final
hashCode int
The hash code for this object.
no setterinherited
manifest NiceModuleManifest?
Current manifest.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
viewService NiceViewService?
final

Methods

deltaUpdate(String moduleId) Future<int>
Delta update: check for updated views in a module and refresh only changed ones.
isModuleLoaded(String moduleId) bool
Check if a module is loaded.
loadAllActive() Future<List<String>>
Load all active modules from the manifest.
loadManifest(Map<String, dynamic> manifestJson) Future<void>
Load and apply the module manifest.
loadModule(String moduleId) Future<bool>
Lazily load a module. Checks feature flags before loading.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerModule(String moduleId, NiceModuleInitializer initializer) → void
Register a module initializer for lazy loading.
rollback(String module, String viewId) Future<bool>
Rollback a view to the previously saved version.
rollbackHistoryCount(String module, String viewId) Future<int>
Get rollback history count for a view.
saveRollbackPoint(String module, String viewId) Future<void>
Save current view definition as rollback point.
toString() String
A string representation of this object.
inherited

Operators

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