lazyReplace<P> method

void lazyReplace<P>(
  1. InstanceBuilderCallback<P> builder, {
  2. String? tag,
  3. bool? fenix,
})

Replaces a parent instance with a new Instance

lazily from the <P>builder() callback.

  • tag optional, if you use a tag to register the Instance.
  • fenix optional

Note: if fenix is not provided it will be set to true if the parent instance was permanent

Implementation

void lazyReplace<P>(InstanceBuilderCallback<P> builder,
    {String? tag, bool? fenix}) {
  final info = GetInstance().getInstanceInfo<P>(tag: tag);
  final permanent = (info.isPermanent ?? false);
  delete<P>(tag: tag, force: permanent);
  lazyPut(builder, tag: tag, fenix: fenix ?? permanent);
}