A boolean logic library for Dart and Flutter, allowing you to build trees of conditions and evaluate them.
While there is no limit to what you can/should do with blackbird
, it's aimed at building flexible query UIs for your applications.
Blackbird is designed to provide the building blocks for building condition trees (blackbird is named after Blackbird State Forest in Delaware, US.). Out of the box, it provides the Condition
, NestedCondition
, TestCondition
, and Test
classes. You can use these to build complex trees of conditions and evaluate them.
Check out the example for a simple example.
final condition = Or(
[
IsTrue(StartsWithLowerCase()),
IsTrue(ContainsString('One')),
],
);
expect(condition.evaluate('hello'), isTrue);
expect(condition.evaluate('On'), isFalse);
- Type-safe: The entire condition tree is typed to your type
T
. - Extensible: Define
Test
objects according to your domain. - Readable: The API is designed to be readable and expressive.
dart pub add blackbird