buildOnStateChange method
Implementation
@override
Widget buildOnStateChange(AuthProvider authProvider, BuildContext context) {
var user = FirebaseAuth.instance.currentUser;
var userProvider = Provider.of<UserProvider>(context, listen: false);
if (user == null) {
return loginWidget;
} else {
if (userProvider.userLocal.uidProviderFirst!.isEmpty) {
// google is the first provider and its uuid to be cached for later usage and review
userProvider.userLocal.uidProviderFirst = user.uid;
}
if (authProvider.is2FactorAuthenticated == null) {
return Material(
child: Scaffold(body: Center(child: CircularProgressIndicator())));
} else if (!authProvider.is2FactorAuthenticated!) {
// Start routing through otp and 2fa screens
return otpControllerWidget;
} else {
// TODO Provider.of<SettingsProvider>(context, listen: false).loadAllSettings();
return mainWidget;
}
}
}