applyFilter function

bool applyFilter(
  1. Map? properties,
  2. dynamic filter
)

applyFilter Takes a Map properties and a filter, Returns a bool indicating filter is applied to the properties.

Implementation

bool applyFilter(Map? properties, dynamic filter) {
  if (properties == null) return false;
  if (filter is! List && filter is! Map && filter is! String) {
    throw Exception("filter('s) key must be String");
  }
  if (filter is String) {
    return properties.containsKey(filter);
  }
  if (filter is List) {
    for (var i = 0; i < filter.length; i++) {
      if (!applyFilter(properties, filter[i])) return false;
    }
    return true;
  }
  if (filter is Map) {
    return propertiesContainsFilter(properties, filter);
  }
  return false;
}