loginEmailAccount static method
Returns a map with the following keys: if there was no error:
session:Sessionfrom Appwrite if there was an error:error:trueif there was an errortype:errorif there was an errormessage:Stringcontaining the error messagecode:intcontaining the error code
Implementation
static Future<Map<String, dynamic>> loginEmailAccount({
/// Email of the user to login
required String email,
/// Password for the email
required String password,
}) async {
Account account = Account(_client);
try {
final models.Session session = await account.createEmailSession(
email: email,
password: password,
);
_session = session;
_storage.write('session', session.toMap());
return session.toMap();
} on AppwriteException catch (e) {
return {
'error': true,
'type': e.type,
'message': e.message,
'code': e.code,
};
}
}