From 4bfe06f0e388d171f0bb558f966b319b051023b6 Mon Sep 17 00:00:00 2001 From: sathesherode Date: Tue, 18 Nov 2025 00:01:28 +0100 Subject: [PATCH 1/2] Preserve selected state when filtering items during search The existing search implementation rebuilt the item list without reapplying selection flags, causing previously selected items to appear unselected in filtered search results. This commit ensures that MultiSelectItem.selected is recalculated based on selectedValues after each search update. Improves UX in MultiSelectDialog by maintaining correct selection state during real-time filtering. --- lib/dialog/mult_select_dialog.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/dialog/mult_select_dialog.dart b/lib/dialog/mult_select_dialog.dart index 433539f..3799b7c 100644 --- a/lib/dialog/mult_select_dialog.dart +++ b/lib/dialog/mult_select_dialog.dart @@ -243,6 +243,9 @@ class _MultiSelectDialogState extends State> { List> filteredList = []; filteredList = widget.updateSearchQuery(val, widget.items); + for (var item in filteredList) { + item.selected = _selectedValues.contains(item.value); + } setState(() { if (widget.separateSelectedItems) { _items = From cf8c1c1177872846444cbb127c25adf04112d0db Mon Sep 17 00:00:00 2001 From: sathesherode Date: Tue, 18 Nov 2025 00:06:52 +0100 Subject: [PATCH 2/2] Update pubspec.yaml --- pubspec.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pubspec.yaml b/pubspec.yaml index 1e676fd..7784c77 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: multi_select_flutter description: A flexible multi select package for Flutter. Make multi select widgets the way you want. -version: 4.1.3 +version: 4.1.4 repository: https://github.com/CHB61/flutter-multi-select issue_tracker: https://github.com/CHB61/flutter-multi-select documentation: https://github.com/CHB61/flutter-multi-select