buildTextSpan method Null safety

InlineSpan? buildTextSpan(
  1. {List<InlineSpan>? children,
  2. GestureRecognizer? recognizer,
  3. TextStyle? style,
  4. String? text}
)

Builds TextSpan.

Implementation

InlineSpan? buildTextSpan({
  List<InlineSpan>? children,
  GestureRecognizer? recognizer,
  TextStyle? style,
  String? text,
}) {
  if (text?.isEmpty == true) {
    if (children?.isEmpty == true) {
      return null;
    }
    if (children?.length == 1) {
      return children!.first;
    }
  }

  return TextSpan(
    children: children,
    mouseCursor: recognizer != null ? SystemMouseCursors.click : null,
    recognizer: recognizer,
    style: style,
    text: text,
  );
}