text field automatically getting unfocus flutter code example
Example 1: flutter unfocus textfield
FocusScopeNode currentFocus = FocusScope.of(context);
if (!currentFocus.hasPrimaryFocus) {
currentFocus.unfocus();
}
Example 2: flutter unfocus textfield
FocusScope.of(context).unfocus();