Skip to content

Instantly share code, notes, and snippets.

@danahartweg
Last active July 27, 2020 04:23
Show Gist options
  • Save danahartweg/594b5badf5b5a9e5a54b173fd28d2efc to your computer and use it in GitHub Desktop.
Save danahartweg/594b5badf5b5a9e5a54b173fd28d2efc to your computer and use it in GitHub Desktop.
Item list boolean filtering - Support boolean properties to flutter_bloc_list_manager
return items.where((item) => activeConditions.any((conditionKey) {
final parsedConditionKey = splitConditionKey(conditionKey);
final property = parsedConditionKey[0];
final itemValue = item[property];
final targetValue = parsedConditionKey[1];
if (itemValue is bool) {
return itemValue.toString() == targetValue.toLowerCase();
}
return itemValue == targetValue;
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment