login method

Future login(
  1. String? username,
  2. String? password
)

logs the user in and updates the UI

Implementation

Future login(String? username, String? password) async {
  // current kürzel and password for testing are HH testpass
  if (username == null || password == null) {
    throw Exception(S.current!.usernameOrPasswordWasNotGiven);
  }

  var res = await API().login(User(username, password));
  debugPrint('logged in, ${res.toString()}');
  notifyListeners();
}