Jermaine McFarlane

ensure permanent instances are replaced

@@ -131,8 +131,11 @@ extension Inst on GetInterface { @@ -131,8 +131,11 @@ extension Inst on GetInterface {
131 131
132 /// Replace a parent instance of a class in dependency management 132 /// Replace a parent instance of a class in dependency management
133 /// with a [child] instance 133 /// with a [child] instance
134 - void replace<P, C extends P>(C child, {String? tag, bool permanent = false}) {  
135 - delete<P>(); 134 + /// - [tag] optional, if you use a [tag] to register the Instance.
  135 + void replace<P, C extends P>(C child, {String? tag}) {
  136 + final info = GetInstance().getInstanceInfo<P>(tag: tag);
  137 + final permanent = (info.isPermanent ?? false);
  138 + delete<P>(tag: tag, force: permanent);
136 // ignore: unnecessary_cast 139 // ignore: unnecessary_cast
137 put(child as P, tag: tag, permanent: permanent); 140 put(child as P, tag: tag, permanent: permanent);
138 } 141 }