register<T extends Object?> method
Registers a builder
function into to instances
to allows to create the instance with get.
Returns true
when instance has been registered.
Implementation
bool register<T extends Object?>({
required ContextBuilder<T> builder,
String? id,
}) {
final instance = ReactterInstance<T?>.withBuilder(id, builder);
if (_reactterInstanceManager.instances.contains(instance)) {
Reactter.log('Instance "$instance" already registered.');
return false;
}
_reactterInstanceManager.instances.add(instance);
UseEvent<T>(id).emit(Lifecycle.registered);
Reactter.log('Instance "$instance" has been registered.');
return true;
}