FilteringTextInputFormatter constructor Null safety

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

Creates a formatter that prevents the insertion of characters based on a filter pattern.

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);