supabase_hooks 0.0.1
supabase_hooks: ^0.0.1 copied to clipboard
Unofficial Flutter Supabase life cycle adaptation for flutter_hooks.
Unofficial Supabase life cycle adaptation for flutter_hooks. See more in the original package: https://github.com/supabase/supabase-flutter
Note: This library is completely experimental and not recommended for production usage.
The idea is the same as in LifeHook, except that you can override more methods, specific to Supabase Auth life cycle
AuthState useAuthState({
required final ScreenLayout screenLayout,
}) =>
use(
LifeHook(
debugLabel: 'SettingsState',
state: AuthState(
screenLayout: screenLayout,
),
),
);
class AuthState extends SupabaseAuthLifeState {
AuthState({
required this.screenLayout,
});
final ScreenLayout screenLayout;
@override
void initState() {}
@override
void dispose() {}
@override
void onUnauthenticated() {}
/// Callback when user is authenticated
@override
void onAuthenticated(final Session session) {}
/// Callback when authentication deeplink is recovery password type
@override
void onPasswordRecovery(final Session session) {}
/// Callback when recovering session from authentication deeplink throws error
@override
void onErrorAuthenticating(final String message) {}
}
copied to clipboard