Home > front end >  How to allow text and emojis only in text field (no special characters/symbols)
How to allow text and emojis only in text field (no special characters/symbols)

Time:02-18

I'm trying to just allow a textfield to allow any input with text and emojis, no special character/symbols because it gives all sorts of error.

I only know how to remove all special characters with inputFormatter, but it also disable all emojis.

inputFormatters: [new WhitelistingTextInputFormatter(RegExp("[a-zA-Z]")),],

Does anyone know how to do this?

CodePudding user response:

This package will help you.

try to use this package flutter_emoji

and use like this

static final RegExp REGEX_EMOJI = RegExp(r'(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])');
  • Related