dismissKeyboard static method
DO THAT:
final FocusScopeNode focus = FocusScope.of(context);
if (!focus.hasPrimaryFocus) focus.requestFocus(FocusNode());
Implementation
static void dismissKeyboard(BuildContext context) {
final FocusScopeNode focus = FocusScope.of(context);
if (focus.hasFocus) {
focus.unfocus();
} else {
focus.requestFocus(FocusNode());
}
}