preventSpaces property

TextInputFormatter get preventSpaces

Rejects all whitespace characters (spaces, tabs, newlines) anywhere in the input.

Use this on fields where whitespace is never valid, such as usernames or tokens.

Implementation

static TextInputFormatter get preventSpaces => FilteringTextInputFormatter.deny(RegExp(r"\s"));