BaiomyInputFormatters class
A comprehensive collection of input formatters for text validation and filtering Designed to be scalable and easily extensible for future requirements
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
-
alphanumericOnly
→ List<
TextInputFormatter> -
Allows alphanumeric characters and spaces
Good for usernames and mixed content
no setter
-
cleanText
→ List<
TextInputFormatter> -
For general text inputs that need to be clean
Denies emojis and profanity, allows alphanumeric
no setter
-
creditCard
→ List<
TextInputFormatter> -
For credit card numbers (digits with spaces every 4 characters)
no setter
-
currency
→ List<
TextInputFormatter> -
For currency inputs (numbers with decimal points)
no setter
-
denyEmojis
→ List<
TextInputFormatter> -
Denies emoji and special Unicode symbols
Most commonly used formatter for names and basic text inputs
no setter
-
denyProfanity
→ List<
TextInputFormatter> -
Basic profanity filter
Can be extended with more comprehensive word lists
no setter
-
emailField
→ List<
TextInputFormatter> -
For email inputs (additional client-side validation)
Note: Server-side validation is still required
no setter
-
emailSafe
→ List<
TextInputFormatter> -
Allows email-safe characters
Includes letters, numbers, @, ., _, -, and +
no setter
-
lettersOnly
→ List<
TextInputFormatter> -
Allows only letters and spaces (supports multiple languages)
Ideal for names in different languages
no setter
-
nameField
→ List<
TextInputFormatter> -
Most common combination for user names
Denies emojis and allows letters/spaces only
no setter
-
notesField
→ List<
TextInputFormatter> -
For notes and descriptions
More permissive but still blocks emojis and profanity
no setter
-
numbersOnly
→ List<
TextInputFormatter> -
Allows only numeric characters
Useful for phone numbers, IDs, and numeric inputs
no setter
-
passwordField
→ List<
TextInputFormatter> -
For password inputs
Allows password-safe characters but denies emojis
no setter
-
passwordSafe
→ List<
TextInputFormatter> -
Allows characters typically used in passwords
Includes letters, numbers, and common special characters
no setter
-
phoneField
→ List<
TextInputFormatter> -
For phone number inputs
Denies emojis and allows only phone-safe characters
no setter
-
phoneNumberSafe
→ List<
TextInputFormatter> -
Allows phone number characters
Includes digits, +, -, (, ), and spaces
no setter
-
urlSafe
→ List<
TextInputFormatter> -
Allows URL-safe characters
Useful for website inputs and links
no setter
-
username
→ List<
TextInputFormatter> -
For username inputs (alphanumeric with specific symbols)
no setter
Static Methods
-
caseFormatter(
{bool uppercase = true}) → List< TextInputFormatter> -
Creates a case formatter (uppercase/lowercase)
uppercase- true for uppercase, false for lowercase -
containsEmojis(
String text) → bool - Checks if text contains emojis
-
containsProfanity(
String text) → bool - Checks if text contains profanity
-
customAllow(
List< RegExp> patterns) → List<TextInputFormatter> -
Creates a custom formatter that only allows specified patterns
patterns- List of RegExp patterns to allow -
customDeny(
List< RegExp> patterns, {bool allowEmojis = false}) → List<TextInputFormatter> -
Creates a custom formatter with multiple regex patterns
patterns- List of RegExp patterns to denyallowEmojis- Whether to allow emojis (default: false) -
getCleanCharacterCount(
String text) → int - Gets character count excluding emojis
-
isNumericOnly(
String text) → bool - Checks if text contains only numbers
-
lengthLimit(
int maxLength) → List< TextInputFormatter> -
Creates a formatter that limits text length
maxLength- Maximum allowed characters -
nameWithLength(
[int maxLength = 35]) → List< TextInputFormatter> -
Creates a formatter for names with length limit
maxLength- Maximum allowed characters (default: 35) -
notesWithLength(
[int maxLength = 500]) → List< TextInputFormatter> -
Creates a formatter for notes with length limit
maxLength- Maximum allowed characters (default: 500) -
phoneWithLength(
[int exactLength = 11]) → List< TextInputFormatter> -
Creates a formatter for phone with exact length
exactLength- Exact required length (default: 11)