getMemberMediumModelChainOfMedium static method
Future<List<MemberMediumModel> >
getMemberMediumModelChainOfMedium(
- String? appId,
- MemberMediumModel memberMediumModel
Implementation
static Future<List<MemberMediumModel>> getMemberMediumModelChainOfMedium(
String? appId, MemberMediumModel memberMediumModel) async {
var infos = <MemberMediumModel>[];
var currentPolicy = memberMediumModel;
infos.add(currentPolicy);
while (currentPolicy.relatedMediumId != null) {
var newPolicy = await memberMediumRepository(appId: appId)!
.get(currentPolicy.relatedMediumId);
if (newPolicy == null) {
print("Can't get policy");
} else {
currentPolicy = newPolicy;
infos.add(currentPolicy);
}
}
return infos;
}