InputOTPChild class abstract

Abstract base class for OTP input child elements.

Defines the interface for children that can be placed within an InputOTP widget, including actual input fields, separators, and spacers. Subclasses implement the build method to render their content.

Common factories:

Example:

InputOTP(
  children: [
    InputOTPChild.input(predicate: (cp) => cp >= 48 && cp <= 57),
    InputOTPChild.space,
    InputOTPChild.input(),
  ],
)
Implementers

Constructors

InputOTPChild()
Creates an InputOTPChild.
const
InputOTPChild.character({bool allowLowercaseAlphabet = false, bool allowUppercaseAlphabet = false, bool allowDigit = false, bool obscured = false, bool onlyUppercaseAlphabet = false, bool onlyLowercaseAlphabet = false, bool readOnly = false, TextInputType? keyboardType})
Creates a character input with alphabet and digit filtering.
factory
InputOTPChild.input({CodepointPredicate? predicate, CodepointUnaryOperator? transform, bool obscured = false, bool readOnly = false, TextInputType? keyboardType})
Creates a customizable character input field.
factory

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 setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

build(BuildContext context, InputOTPChildData data) Widget
Builds the widget for this OTP child.
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

empty InputOTPChild
An empty placeholder that takes no space.
no setter
separator InputOTPChild
A visual separator between OTP groups (e.g., a dash or line).
no setter
space InputOTPChild
Spacing between OTP input fields.
no setter