fetchLogin method
Implementation
Future<bool> fetchLogin() async {
try {
var res = await api
.authReq("User:get", body: {"image_variation": imageVariation});
//print("Received user = $res");
var u = new UserInfo();
u.object = res.data;
u.email = res["Email"];
try {
u.displayName = res["Profile"]["Display_Name"];
} catch (e) {}
try {
u.profilePicture = res["Profile"]["Drive_Item"]["Media_Image"]
["Variation"]["strip&format=jpeg&scale_crop=160x160"];
} catch (e) {}
info = u;
loading = false;
notifyListeners();
return true;
} on AtOnlineLoginException {
// failed (no login info)
info = null;
loading = false;
notifyListeners();
return false;
} on AtOnlinePlatformException {
// failed (access denied, etc)
info = null;
loading = false;
notifyListeners();
return false;
} catch (e) {
// not logged in
info = null;
loading = false;
notifyListeners();
return false;
}
}