FilteringTextInputFormatter constructor Null safety

FilteringTextInputFormatter(
  1. Pattern filterPattern,
  2. {required bool allow,
  3. String replacementString = ''}
)

Creates a formatter that replaces banned patterns with the given replacementString.

If allow is true, then the filter pattern is an allow list, and characters must match the pattern to be accepted. See also the FilteringTextInputFormatter.allow constructor.

If allow is false, then the filter pattern is a deny list, and characters that match the pattern are rejected. See also the FilteringTextInputFormatter.deny constructor.

The filterPattern, allow, and replacementString arguments must not be null.

Implementation

// TODO(goderbauer): Cannot link to the constructor because of https://github.com/dart-lang/dartdoc/issues/2276.
///
/// If [allow] is false, then the filter pattern is a deny list,
/// and characters that match the pattern are rejected. See also
/// the [FilteringTextInputFormatter.deny] constructor.
///
/// The [filterPattern], [allow], and [replacementString] arguments
/// must not be null.
FilteringTextInputFormatter(
  this.filterPattern, {
  required this.allow,
  this.replacementString = '',
}) : assert(filterPattern != null),
     assert(allow != null),
     assert(replacementString != null);