firebaseToMemberModel static method
Future<MemberModel>
firebaseToMemberModel(
- User usr
)
Implementation
static Future<MemberModel> firebaseToMemberModel(User usr) async {
var futureMemberModel =
await repos.memberRepository()!.get(usr.uid).then((member) async {
if (member == null) {
member = MemberModel(
documentID: usr.uid,
name: usr.displayName,
email: usr.email,
isAnonymous: usr.isAnonymous,
photoURL: usr.photoURL,
subscriptions: [],
/*items:[]*/
);
await getMemberClaimModel(member);
return await repos.memberRepository()!.add(member);
} else {
await getMemberClaimModel(member);
return member;
}
}).catchError((onError) {
var errorMsg = 'Exception in firebaseToMemberModel $onError';
print(errorMsg);
throw Exception(errorMsg);
});
return futureMemberModel;
}