PinInputController class
A controller class that manages the state of PIN input fields.
This controller extends ChangeNotifier to allow widgets to listen to changes in the PIN input text. It's used to control the number of input fields and track the current text value.
Example usage:
final controller = PinInputController(length: 6);
// Listen to changes
controller.addListener(() {
print('Current PIN: ${controller.text}');
});
- Inheritance
-
- Object
- ChangeNotifier
- PinInputController
Constructors
- PinInputController({required int length, String text = ''})
- Creates a new PinInputController.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- isComplete → bool
-
Checks if the PIN input is complete (all fields filled).
no setter
- isEmpty → bool
-
Checks if the PIN input is empty.
no setter
- length → int
-
The number of PIN input fields to display.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- text → String
-
Gets the current text value.
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
changeText(
String text) → void - Updates the text value and notifies all listeners.
-
clear(
) → void - Clears the current text value.
-
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
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