doAttemptRegister method
Implementation
@override
Future<AuthResponse> doAttemptRegister(BuildContext context,
{credentials}) async {
try {
try {
final router = context.get<FRouter>();
final route = router.matchRoute(registerRoutePath)!;
assert(!route.isMissing,
"You must provide a route /loginEmailPassword to use this login handler");
final usernamePassword = await route.route!.openModal(
context,
expand: false,
nestModals: true,
constraints: loginModalConstraints(context),
);
if (usernamePassword == null) {
return AuthResponse.cancelled();
}
assert(usernamePassword is UserCredential,
"The response from /loginEmailPassword must be UserCredential");
var c = usernamePassword as fb.UserCredential;
return c.user == null
? AuthResponse.cancelled()
: AuthResponse.userLogin(user: c.user);
} catch (e, stack) {
_log.severe("Error from server: $e", e, stack);
return AuthResponse.error(e);
}
} catch (e, stack) {
_log.severe("Error from server: $e", e, stack);
return AuthResponse.error("There was an error logging you in");
}
}