login method

Future<DisplayUser?> login(
  1. User user
)

login a User by checking if he exists in the remote database

Implementation

Future<DisplayUser?> login(User user) async {
  if (await isUserLoggedIn(user)) return this.user;
  try {
    final _user = await remote.login(user);
    await _user!.store();
    return this.user;
  } catch (e) {
    logout();
    rethrow;
  }
}