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