Currently, I know the method of hiding the soft keyboard using this code, by onTap methods of any widget.
FocusScope.of(context).requestFocus(new
Starting May 2019, FocusNode now has unfocus method:
Cancels any outstanding requests for focus.
This method is safe to call regardless of whether this node has ever requested focus.
Use unfocus if you have declared a FocusNode for your text fields:
final focusNode = FocusNode();
// ...
focusNode.unfocus();
My original answer suggested detach method - use it only if you need to get rid of your FocusNode completely. If you plan to keep it around - use unfocus instead.
If you have not declared a FocusNode specifically - use unfocus for the FocusScope of your current context:
FocusScope.of(context).unfocus();
See revision history for the original answer.