TextSpan constructor Null safety

const TextSpan(
  1. {String? text,
  2. List<InlineSpan>? children,
  3. TextStyle? style,
  4. GestureRecognizer? recognizer,
  5. MouseCursor? mouseCursor,
  6. PointerEnterEventListener? onEnter,
  7. PointerExitEventListener? onExit,
  8. String? semanticsLabel,
  9. Locale? locale,
  10. bool? spellOut}
)

Creates a TextSpan with the given values.

For the object to be useful, at least one of text or children should be set.

Implementation

const TextSpan({
  this.text,
  this.children,
  super.style,
  this.recognizer,
  MouseCursor? mouseCursor,
  this.onEnter,
  this.onExit,
  this.semanticsLabel,
  this.locale,
  this.spellOut,
}) : mouseCursor = mouseCursor ??
       (recognizer == null ? MouseCursor.defer : SystemMouseCursors.click),
     assert(!(text == null && semanticsLabel != null));