TextPainter constructor Null safety

TextPainter(
  1. {InlineSpan? text,
  2. TextAlign textAlign = TextAlign.start,
  3. TextDirection? textDirection,
  4. double textScaleFactor = 1.0,
  5. int? maxLines,
  6. String? ellipsis,
  7. Locale? locale,
  8. StrutStyle? strutStyle,
  9. TextWidthBasis textWidthBasis = TextWidthBasis.parent,
  10. TextHeightBehavior? textHeightBehavior}
)

Creates a text painter that paints the given text.

The text and textDirection arguments are optional but text and textDirection must be non-null before calling layout.

The textAlign property must not be null.

The maxLines property, if non-null, must be greater than zero.

Implementation

TextPainter({
  InlineSpan? text,
  TextAlign textAlign = TextAlign.start,
  TextDirection? textDirection,
  double textScaleFactor = 1.0,
  int? maxLines,
  String? ellipsis,
  Locale? locale,
  StrutStyle? strutStyle,
  TextWidthBasis textWidthBasis = TextWidthBasis.parent,
  ui.TextHeightBehavior? textHeightBehavior,
}) : assert(text == null || text.debugAssertIsValid()),
     assert(textAlign != null),
     assert(textScaleFactor != null),
     assert(maxLines == null || maxLines > 0),
     assert(textWidthBasis != null),
     _text = text,
     _textAlign = textAlign,
     _textDirection = textDirection,
     _textScaleFactor = textScaleFactor,
     _maxLines = maxLines,
     _ellipsis = ellipsis,
     _locale = locale,
     _strutStyle = strutStyle,
     _textWidthBasis = textWidthBasis,
     _textHeightBehavior = textHeightBehavior;