Comparison/text filter and nested AND, OR and NOT expressions.
The default operator is equality. Text operators ignore case. Empty AND is true; empty OR is false. Dart matches(item) returns bool; Vue txMatches(item, filter) returns boolean. Getter errors propagate.
TxFilter
| Parameter | Type | Default | Meaning |
|---|---|---|---|
| selector | TxGetter<T>? | required | Field path or getter for a query value. |
| value | Object? | required | Current input/option value. |
| operator | TxFilterOperator | TxFilterOperator.equal | Comparison/text operator. |
TxFilter.and
| Parameter | Type | Default | Meaning |
|---|---|---|---|
| filters | List<TxFilter<T>> | required | Child filters of the logical junction. |
TxFilter.or
| Parameter | Type | Default | Meaning |
|---|---|---|---|
| filters | List<TxFilter<T>> | required | Child filters of the logical junction. |
TxFilter.not
| Parameter | Type | Default | Meaning |
|---|---|---|---|
| filter | TxFilter<T> | required | Filter expression. |
| Member / type / return | Meaning |
|---|---|
final List<TxFilter<T>>? children | Child filters or contained widgets. |
final String? junction | and/or/not junction of a compound filter. |
bool matches(T item) | Synchronously tests a record against this filter. |
import 'package:tecexpress/tecexpress.dart';
Future<void> example() async {
final adult = TxFilter<int>((v) => v, 18, operator: TxFilterOperator.greaterOrEqual);
print(adult.matches(20));
print(TxFilter.and([adult, TxFilter.not(TxFilter<int>((v) => v, 30))]).matches(20));
print(TxFilter.or([adult]).matches(20));
}