📦Implementação na Store
Exemplos de usos dos usecases de autenticação nas stores.
@action
Future loginWithGoogle(BuildContext context) async {
try {
loading = true;
final result = await GetIt.I.get<ILoginWithGoogleUsecase>()();
return result.fold(
(l) {
loading = false;
customErrorHelper(context, e: l);
printException("AuthStore.loginWithGoogle", l, l);
return false;
},
(r) async {
loading = false;
//CASO QUEIRA USAR A CLASSE LOCAL AUTHENTICATION PARA VERIFICAÇÕES:
Authentication.saveToken(
(await FirebaseAuth.instance.currentUser?.getIdToken()) ?? "",
);
return true;
},
);
} catch (e, s) {
printException("AuthStore.loginWithGoogle", e, s);
loading = false;
return false;
}
}Last updated