From d0a34fd7413ada3b14d571c99e2dc526ba2003cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Nilson?=
 <62351612+Noslin22@users.noreply.github.com>
Date: Tue, 17 Dec 2024 19:07:26 -0300
Subject: [PATCH] Remove Null Checker

---
 lib/src/searchfield.dart | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/src/searchfield.dart b/lib/src/searchfield.dart
index 2d56870..aa8486e 100644
--- a/lib/src/searchfield.dart
+++ b/lib/src/searchfield.dart
@@ -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 =