build method

  1. @override
Future<Filter<MedicalDevice>> build()
override

Implementation

@override
Future<Filter<MedicalDevice>> build() async {
  List<Filter<MedicalDevice>> filters = [
    _byIds?.let((v) => MedicalDeviceByIdsFilter(ids: v)),
    await _union?.let((v) async => UnionFilter<MedicalDevice>(filters: await Future.wait(v.map((f) async => await f.build()).toList()))),
    await _intersection
        ?.let((v) async => IntersectionFilter<MedicalDevice>(filters: await Future.wait(v.map((f) async => await f.build()).toList())))
  ].whereType<Filter<MedicalDevice>>().toList();

  if (filters.isEmpty) {
    return AllMedicalDevicesFilter();
  } else if (filters.length == 1) {
    return filters[0];
  } else {
    return IntersectionFilter(filters: filters);
  }
}