Skip to content

Conversation

@arakakil
Copy link

The filter applies it to the filtered list instead of to all items in the initial list.

The filter method of the FilterState class applies the filter on the items (_items) containing the items that were filtered as you type in the search field.

If a variable is added, e.g. List? _allItems; in which the original list is stored as follows:

FilterState({List<K>? allItems, List<K>? selectedItems}) {
    this.selectedItems = selectedItems;
    items = allItems;
    _allItems = allItems;
  }

And you modify the filter function to use the _allItems variable instead of _items, the problem is solved.

// perform filter operation
  void filter(bool Function(K) filter) {
    _items = _allItems!.where(filter).toList();
    notifyListeners();
  }

You might consider doing a merge of this change?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant