FacetList (refinement list) is a filtering components that displays facets, and lets the user refine their search results by filtering on specific values.
Create Facet List
Create FacetList with given HitsSearcher and FilterState components :
// Create a HitsSearcher
final searcher = HitsSearcher(
applicationID: 'MY_APPLICATION_ID',
apiKey: 'MY_API_KEY',
indexName: 'MY_INDEX_NAME',
);
// Create a FilterState
final filterState = FilterState();
// Create a FacetList
final facetList = searcher.buildFacetList(
filterState: filterState,
attribute: 'MY_ATTRIBUTE',
);
Get selectable facet lists
Get selectable facets changes by listening to facets submissions:
facetList.facets.listen((facets) {
for (var facet in facets) {
print("${facet.item} ${facet.isSelected ? 'x' : '-'}");
}
});
Toggle facet
Call toggle to selected/deselect a facet value:
facetList.toggle('MY_FACET_VALUE');
Dispose
Call dispose to release underlying resources:
facetList.dispose();
- Implemented types
- Annotations
-
- @experimental
Constructors
-
FacetList({required Stream<
List< facetsStream, required SelectionState state, SelectionMode selectionMode = SelectionMode.multiple, bool persistent = false, FilterEventTracker? eventTracker})Facet> > -
Create FacetList instance.
factory
Properties
- eventTracker → FilterEventTracker?
-
Insights events tracking component
no setter
-
facets
→ Stream<
List< SelectableFacet> > -
Stream of Facet list with selection status.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isDisposed → bool
-
Whether this Disposable has already released its resources.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- state → SelectionState
-
Selection state
no setter
Methods
-
dispose(
) → void -
Releases this Disposable resources.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
snapshot(
) → List< SelectableFacet> ? - Snapshot of the latest facets value.
-
toggle(
String value) → void - Select/deselect the provided facet value depending on the current selection state.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited