skip to Main Content

Authetication using Go Routers with flutter

class AuthGate extends StatelessWidget { const AuthGate({super.key}); @override Widget build(BuildContext context) { final AuthService authService = AuthService(); final userProvider = context.read<UserProvider>(); WidgetsBinding.instance.addPostFrameCallback((_) async { await authService.getUserData(context: context); if (userProvider.userModel.token.isNotEmpty) { context.go(AppRouterName.homeView.path); } else { context.go(AppRouterName.signInView.path); } }); return const Scaffold(…

VIEW QUESTION

Flutter/Dart Future

class _WorterBuchState extends State<WorterBuch> with TickerProviderStateMixin { var wordPair= '' ; @override void initState(){ super.initState(); load(); } Future<void> load() async{ SharedPreferences prefs = await SharedPreferences.getInstance(); prefs.setString('key', 'value'); wordPair = await "key : " + (prefs.getString('key') as String); } @override Widget…

VIEW QUESTION
Back To Top
Search