CharacterInputOTPChild class
A character-based OTP input field with validation and transformation.
Supports filtering input based on codepoint predicates and transforming input characters (e.g., converting to uppercase). Commonly used for creating numeric or alphanumeric OTP fields.
Example:
CharacterInputOTPChild(
predicate: CharacterInputOTPChild.isDigit,
keyboardType: TextInputType.number,
)
- Inheritance
-
- Object
- InputOTPChild
- CharacterInputOTPChild
Constructors
- CharacterInputOTPChild({CodepointPredicate? predicate, CodepointUnaryOperator? transform, bool obscured = false, bool readOnly = false, TextInputType? keyboardType})
-
Creates a CharacterInputOTPChild.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasValue → bool
-
Whether this child can hold a value (i.e., is an input field).
no setteroverride
- keyboardType → TextInputType?
-
The keyboard type to use for input.
final
- obscured → bool
-
Whether to obscure the input character.
final
- predicate → CodepointPredicate?
-
Predicate to validate allowed codepoints.
final
- readOnly → bool
-
Whether the input is read-only.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- transform → CodepointUnaryOperator?
-
Function to transform codepoints before storing.
final
Methods
-
build(
BuildContext context, InputOTPChildData data) → Widget -
Builds the widget for this OTP child.
override
-
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 Methods
-
isAlphabetLower(
int codepoint) → bool - Tests if the codepoint is a lowercase letter (a-z).
-
isAlphabetUpper(
int codepoint) → bool - Tests if the codepoint is an uppercase letter (A-Z).
-
isDigit(
int codepoint) → bool - Tests if the codepoint is a digit (0-9).
-
lowerToUpper(
int codepoint) → int - Converts a lowercase letter to uppercase.
-
upperToLower(
int codepoint) → int - Converts an uppercase letter to lowercase.