KnowableLengthLimitingTextInputFormatter constructor

KnowableLengthLimitingTextInputFormatter(
  1. int? maxLength, {
  2. ValueChanged<int>? onThreshold,
  3. MaxLengthEnforcement? maxLengthEnforcement,
})

Creates a formatter that prevents the insertion of more characters than a limit.

The maxLength must be null, -1 or greater than zero. If it is null or -1 then no limit is enforced.

Implementation

KnowableLengthLimitingTextInputFormatter(
  this.maxLength, {
  this.onThreshold,
  this.maxLengthEnforcement,
}) : assert(maxLength == null || maxLength == -1 || maxLength > 0);