Skip to content

Commit

Permalink
Merge pull request #197 from Noslin22/tweaks
Browse files Browse the repository at this point in the history
Remove Null Checker
  • Loading branch information
maheshj01 authored Dec 24, 2024
2 parents 3b45753 + 493a501 commit 7047ebe
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/src/searchfield.dart
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,9 @@ class _SearchFieldState<T> extends State<SearchField<T>> {
if (oldWidget.selectedValue != widget.selectedValue) {
// highlightIndex = widget.suggestions
// .indexWhere((element) => element == widget.selectedValue);
searchController!.text = widget.selectedValue!.searchKey;

//Just made removed the null check, so that I can clear the field by defining the selectedValue to null
searchController!.text = widget.selectedValue?.searchKey ?? '';
}
if (oldWidget.searchInputDecoration != widget.searchInputDecoration) {
widget.searchInputDecoration =
Expand Down

0 comments on commit 7047ebe

Please sign in to comment.