replace<P> static method

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

Replaces the specified child widget with a new one.

Implementation

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