InterceptLengthLimitingTextInputFormatter constructor

InterceptLengthLimitingTextInputFormatter(
  1. int maxLength, {
  2. InterceptValue<TextEditingValue>? onIntercept,
  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

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