propertiesContainsFilter function

bool propertiesContainsFilter(
  1. Map properties,
  2. Map filter
)

Properties contains filter (does not apply deepEqual operations) Takes a Map properties value, and a Map filter and Returns bool if filter does equal the properties For example

propertiesContainsFilter({foo: 'bar', cluster: 0}, {cluster: 0})
//= true
propertiesContainsFilter({foo: 'bar', cluster: 0}, {cluster: 1})
//= false

Implementation

bool propertiesContainsFilter(Map properties, Map filter) {
  var keys = filter.keys.toList();
  for (var i = 0; i < keys.length; i++) {
    var key = keys[i];
    if (properties[key] != filter[key]) return false;
  }
  return true;
}