isAuthenticated property

Future<AuthStatus> get isAuthenticated

Check if user is authenticated

Implementation

static Future<AuthStatus> get isAuthenticated async {
  bool tokenExists = DashCliEnv.instance.env.authToken != null &&
      DashCliEnv.instance.env.authToken!.isNotEmpty;
  if (tokenExists) {
    bool tokenExpired = DashCliEnv.instance.env.isAuthTokenExpired;
    return tokenExpired
        ? AuthStatus.authenticationExpired
        : AuthStatus.authenticated;
  }
  return AuthStatus.notAuthenticated;
}