KnowableLengthLimitingTextInputFormatter class
A TextInputFormatter that prevents the insertion of more characters (currently defined as Unicode scalar values) than allowed.
Since this formatter only prevents new characters from being added to the text, it preserves the existing TextEditingValue.selection.
- maxLength, which discusses the precise meaning of "number of characters" and how it may differ from the intuitive meaning.
- Inheritance
-
- Object
- TextInputFormatter
- KnowableLengthLimitingTextInputFormatter
Constructors
-
KnowableLengthLimitingTextInputFormatter(int? maxLength, {ValueChanged<
int> ? onThreshold, MaxLengthEnforcement? maxLengthEnforcement}) - Creates a formatter that prevents the insertion of more characters than a limit.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- maxLength → int?
-
The limit on the number of characters (i.e. Unicode scalar values) this formatter
will allow.
final
- maxLengthEnforcement → MaxLengthEnforcement?
-
Determines how the maxLength limit should be enforced.
final
-
onThreshold
→ ValueChanged<
int> ? -
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
formatEditUpdate(
TextEditingValue oldValue, TextEditingValue newValue) → TextEditingValue -
Called when text is being typed or cut/copy/pasted in the EditableText.
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
-
getDefaultMaxLengthEnforcement(
[TargetPlatform? platform]) → MaxLengthEnforcement -
Returns a MaxLengthEnforcement that follows the specified
platform
's convention. -
truncate(
TextEditingValue value, int maxLength) → TextEditingValue - Truncate the given TextEditingValue to maxLength user-perceived characters.