get<T extends GetxController> method

T get<T extends GetxController>({
  1. String? tag,
})

Implementation

T get<T extends GetxController>({String? tag}) {
  if (GetInstance().isRegistered<T>(tag: tag)) {
    LogMessage.d("Creating Controller: ", "$T found, use a old instance.");
    return GetInstance().find<T>(tag: tag);
  } else {
    LogMessage.d("Creating Controller: ",
        "$T not found, initializing a new instance.");
    GetInstance().lazyPut<T>(() => this as T,
        tag:
            tag); // Use the provided factory function to create a new instance
    return GetInstance().find<T>(tag: tag);
  }
}