set focus on textfield 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();