LengthLimitingTextInputFormatter constructor Null safety

LengthLimitingTextInputFormatter(
  1. int? maxLength,
  2. {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

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