hideKeyboard function
hides soft keyboard using platform channel
Implementation
void hideKeyboard(BuildContext context) {
if (!context.mounted) return;
final currentFocus = FocusScope.of(context);
SystemChannels.textInput.invokeMethod<dynamic>('TextInput.hide').ignore();
if (currentFocus.hasFocus) {
currentFocus.unfocus();
currentFocus.focusedChild?.unfocus();
}
}