class Controller extends GetxController {
static Controller get to => Get.find();
static Future<bool> get del => Get.delete<Controller>();
}
위와 같은 형태로 작성하면, Get.find<Controller>(). ...는 Controller.to. ...로, Get.delete<Controller>();는 Get.del;로 사용할 수 있다.
GetX package에서 get/lib/get_instance/src/extension_instance.dart를 보면 아래와 같이 나와있으므로 참고함.
/// Finds a Instance of the required Class `<S>`(or [tag])
/// In the case of using `Get.create()`, it will generate an Instance
/// each time you call `Get.find()`.
S find<S>({String? tag}) => GetInstance().find<S>(tag: tag);
/// Deletes the `Instance<S>`, cleaning the memory and closes any open
/// controllers (`DisposableInterface`).
///
/// - [tag] Optional "tag" used to register the Instance
/// - [force] Will delete an Instance even if marked as `permanent`.
Future<bool> delete<S>({String? tag, bool force = false}) async =>
GetInstance().delete<S>(tag: tag, force: force);
문제가 해결된 후, No key with alias 'key' found in keystore ~\key.jks 이런 오류도 떴는데...
전에 쓰던 명령어는 keytool -genkey -v -keystore ~/key.jks -keyalg RSA -keysize 2048 -validity 10000 -alias key여서, 비교해보니 원래 key라고 쓰던 부분을 pckey라고 썼길래 key.properties에서 keyAlias=key를 keyAlias=pckey로 고쳐줬더니 문제 없이 빌드되었다.
이후 환경변수도 flutter doctor -v로 확인한 binary 경로로 제대로 바꿔주었다.
Warning: JKS 키 저장소는 고유 형식을 사용합니다. "keytool -importkeystore -srckeystore c:/Users/USER_NAME/key.jks -destkeystore c:/Users/USER_NAME/key.jks -deststoretype pkcs12"를 사용하는 산업 표준 형식인 PKCS12로 이전하는 것이 좋습니다.
keytool 오류: java.lang.Exception: 키 쌍이 생성되지 않았으며 <key> 별칭이 존재합니다. java.lang.Exception: 키 쌍이 생성되지 않았으며 <key> 별칭이 존재합니다. at sun.security.tools.keytool.Main.doGenKeyPair(Unknown Source) at sun.security.tools.keytool.Main.doCommands(Unknown Source) at sun.security.tools.keytool.Main.run(Unknown Source) at sun.security.tools.keytool.Main.main(Unknown Source)
가 발생. PKCS12로 이전하라는 말 대로 했을 때
Warning: "c:/Users/USER_NAME/key.jks"을(를) Non JKS/JCEKS(으)로 이전했습니다. JKS 키 저장소가 "c:/Users/USER_NAME/key.jks.old"(으)로 백업되었습니다.
이런 warning이 떴던 걸 기억해서 해당 경로에 있는 key.jks와 key.jks.old 파일을 모두 삭제 후 시도하니 성공. 나중에 build하고 보니, PKCS12 warning은 무시해도 build와 설치에 지장은 없었다.