Filter class sealed
Represents a search filter:
- FilterFacet to filter on facet values
- FilterTag to filter on tags
- FilterNumeric to filter on numeric attributes
Facet filter
Create FilterFacet by calling facet method:
// color:red
final filter = Filter.facet('color', 'red');
Tag filter
Create FilterTag by calling tag method:
// _tags:book
final filter = Filter.tag('book');
Numeric filter
FilterNumeric filters on a numeric value by range (lower/upper bounds) or by comparing it with a NumericOperator.
Numeric comparison
Create FilterNumeric comparing a numeric value using NumericOperator, by calling comparison method:
// 'price <= 42'
final filter = Filter.comparison('price', NumericOperator.lessOrEquals, 42);
Numeric range
Create FilterNumeric with a numeric range by calling range method:
// rating:3 TO 5
final filter = Filter.range('rating', lowerBound: 3, upperBound: 5);
- Implementers
Properties
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
not(
) → Filter - Negates a FilterFacet.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
comparison(
String attribute, NumericOperator operator, num number, {bool isNegated = false}) → FilterNumeric - Creates FilterNumeric instance as numeric comparison.
-
facet(
String attribute, dynamic value, {bool isNegated = false, int? score}) → FilterFacet - Creates FilterFacet instance.
-
range(
String attribute, {required num lowerBound, required num upperBound, bool isNegated = false}) → FilterNumeric - Creates FilterNumeric instance as numeric range.
-
tag(
String value, [bool isNegated = false]) → FilterTag - Creates FilterTag instance.