DesignOtpController class

Holds a code: its text, its length, whether it is whole.

The caller makes it (a State's field, say), keeps it across rebuilds and disposes it; a widget it is given to only listens to it.

DesignOtpController(length: 6)
Inheritance

Constructors

DesignOtpController({required int length, String initialValue = '', RegExp? allowed, TextEditingController? text})
A code of length characters, starting at initialValue (filtered by allowed). Given text, the code lives in that input instead (a form's own controller): its text is the code, filtered the same way, and it is the caller's to dispose.

Properties

activeIndex → int
The box the next character goes in: the first empty one, or the last when the code is whole.
no setter
allowed → RegExp
One character the code takes (a digit, by default).
final
hashCode → int
The hash code for this object.
no setterinherited
hasListeners → bool
Whether any listeners are currently registered.
no setterinherited
isComplete → bool
Whether every box is filled.
no setter
length → int
How many characters the code has.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
text ↔ TextEditingController
The input under the boxes; DesignOtpField attaches it.
latefinal
value → String
The code so far.
no setter

Methods

addListener(VoidCallback listener) → void
Register a closure to be called when the object changes.
inherited
charAt(int index) → String
The character in box index, or '' while it is empty.
clear() → void
Empties every box.
dispose() → void
Discards any resources used by the object.
override
fill(String raw) → void
Fills the boxes from raw (a paste), dropping what the code does not allow and what does not fit.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyListeners() → void
Call all the registered listeners.
inherited
paste() → Future<void>
Fills the boxes from the clipboard: for a look's own Paste control.
removeListener(VoidCallback listener) → void
Remove a previously registered closure from the list of closures that are notified when the object changes.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited