replace<P> method

void replace<P>(
  1. P child, {
  2. String? tag,
})

Replace a parent instance of a class in dependency management with a child instance

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

Implementation

void replace<P>(P child, {String? tag}) {
  final info = GetInstance().getInstanceInfo<P>(tag: tag);
  final permanent = (info.isPermanent ?? false);
  delete<P>(tag: tag, force: permanent);
  put(child, tag: tag, permanent: permanent);
}