Text.rich constructor Null safety

const Text.rich(
  1. InlineSpan textSpan,
  2. {Key? key,
  3. TextStyle? style,
  4. StrutStyle? strutStyle,
  5. TextAlign? textAlign,
  6. TextDirection? textDirection,
  7. Locale? locale,
  8. bool? softWrap,
  9. TextOverflow? overflow,
  10. double? textScaleFactor,
  11. int? maxLines,
  12. String? semanticsLabel,
  13. TextWidthBasis? textWidthBasis,
  14. TextHeightBehavior? textHeightBehavior,
  15. Color? selectionColor}
)

Creates a text widget with a InlineSpan.

The following subclasses of InlineSpan may be used to build rich text:

The textSpan parameter must not be null.

See RichText which provides a lower-level way to draw text.

Implementation

const Text.rich(
  InlineSpan this.textSpan, {
  super.key,
  this.style,
  this.strutStyle,
  this.textAlign,
  this.textDirection,
  this.locale,
  this.softWrap,
  this.overflow,
  this.textScaleFactor,
  this.maxLines,
  this.semanticsLabel,
  this.textWidthBasis,
  this.textHeightBehavior,
  this.selectionColor,
}) : assert(
       textSpan != null,
       'A non-null TextSpan must be provided to a Text.rich widget.',
     ),
     data = null;