getMemberClaimModel static method

Future<MemberClaimModel> getMemberClaimModel(
  1. MemberModel member
)

Implementation

static Future<MemberClaimModel> getMemberClaimModel(
    MemberModel member) async {
  var futureMemberClaimModel = await memberClaimRepository()!
      .get(member.documentID)
      .then((memberClaim) async {
    if (memberClaim == null) {
      memberClaim = MemberClaimModel(
        documentID: member.documentID,
        refreshValue: 1,
      );
      return await memberClaimRepository()!.add(memberClaim);
    } else {
      return memberClaim;
    }
  }).catchError((onError) {
    var errorMsg = 'Exception in getMemberClaimModel $onError';
    print(errorMsg);
    throw Exception(errorMsg);
  });
  return futureMemberClaimModel;
}