desire method

TextSpan desire(
  1. List desirable
)

Implementation

TextSpan desire(List desirable) {
  final desires = [
    style != null ? this : const TextSpan(style: TextStyle()),
    ...desirable.map((e) {
      if (e is TextSpan) return e;
      if (e is Text) return _textToTextSpan(e);
      if (e is TextStyle) return TextSpan(style: e);
      return null;
    }).whereType<TextSpan>(),
  ].toList();

  return TextSpan(
    text: text,
    children: children,
    style: desires
        .map((e) => e.style)
        .whereType<TextStyle>()
        .reduce((acc, e) => acc.merge(e)),
    recognizer: recognizer,
    mouseCursor:
        mapDesire<MouseCursor, TextSpan>(desires, (e) => e.mouseCursor),
    onEnter: onEnter,
    onExit: onExit,
    semanticsLabel:
        mapDesire<String, TextSpan>(desires, (e) => e.semanticsLabel),
    locale: mapDesire<Locale, TextSpan>(desires, (e) => e.locale),
    spellOut: spellOut,
  );
}