signInWithMobile method
Future<void>
signInWithMobile({
- required BuildContext context,
- FluoSignInStyle? style,
- required VoidCallback onExit,
- required VoidCallback onUserReady,
Starts the mobile sign-in flow.
This displays a modal dialog that collects the user's mobile number, sends a verification code via SMS, and validates the session.
Parameters:
context: The build context.style: Optional style configuration for the sign-in screens. If not provided, uses default native or web style based on platform.onExit: Called when the user dismisses the flow without completing.onUserReady: Called when the user successfully signs in and completes all required registration steps.
Implementation
Future<void> signInWithMobile({
required BuildContext context,
FluoSignInStyle? style,
required VoidCallback onExit,
required VoidCallback onUserReady,
}) async {
await CountryManager.init();
style ??= kIsWeb ? FluoSignInStyle.web() : FluoSignInStyle.native();
_showNavigator(
context: context,
style: style,
navigator: AuthNavigator(
initialRoute: AuthNavigator.routeEnterMobile,
onExit: () {
onExit();
Navigator.of(context).pop();
},
onUserAuthenticated: () {
if (isUserReady()) {
onUserReady();
Navigator.of(context).pop();
} else {
Navigator.of(context).pop();
_showRegisterFlow(
context: context,
style: style!,
onUserReady: onUserReady,
);
}
},
),
);
}