getFirstRoute function

Future<String> getFirstRoute(
  1. AuthUserStoryConfiguration configuration,
  2. BuildContext context
)

Implementation

Future<String> getFirstRoute(
  AuthUserStoryConfiguration configuration,
  BuildContext context,
) async {
  var user = await configuration.onGetLoggedInUser?.call(context);
  if (user == null) {
    return AuthUserStoryRoutes.loginScreen;
  }
  if (configuration.useOnboarding && !user.onboarded) {
    return AuthUserStoryRoutes.onboarding;
  } else {
    return configuration.afterLoginRoute ?? '';
  }
}