replace<P> method

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

Replaces a registered dependency with a new one.

Implementation

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