Last active
July 27, 2020 04:23
-
-
Save danahartweg/594b5badf5b5a9e5a54b173fd28d2efc to your computer and use it in GitHub Desktop.
Item list boolean filtering - Support boolean properties to flutter_bloc_list_manager
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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