getProfile static method
Implementation
static Future<ProfileModel?> getProfile() async {
SharedPreferences pref = await SharedPreferences.getInstance();
if (pref.getString(Key_profile) == null) {
return null;
} else {
if (pref.getString(Key_profile) != "") {
if (pref.getString(Key_profile) != "null") {
// print("apa ini ${pref.getString(Key_profile)}");
Map dec = json.decode(pref.getString(Key_profile)!);
if (pref.getString(Key_profile2) != "" || pref.getString(Key_profile2) != "null"){
Map dec2 = json.decode(pref.getString(Key_profile)!);
return ProfileModel.fromJson(dec,data: dec2);
}else{
return ProfileModel.fromJson(dec);
}
} else {
return null;
}
} else {
return null;
}
}
}