login static method
Logins to an account using either id
or address
and password
Implementation
static Future<AuthenticatedUser?> login({
String? id,
String? address,
String? password,
}) async {
assert(
((address != null && password != null) && id == null) ||
((address == null && password == null) && id != null),
"Only one of id and address+password must be provided.",
);
if (id != null) return getUser(id);
final token = (await client.getToken(address!.toLowerCase(), password!));
final user = AuthenticatedUser(
account: await client.getAccount(token.id, token.token),
password: password,
token: token.token,
);
addUser(user.account.id, user);
return user;
}