operator + method

TextStyle operator +(
  1. Object? obj
)

You can create a TextStyle by adding the TextStyle to one these types: Color, FontFamily, FontSize, FontWeight, FontStyle, TextBaseline, Locale, Shadows, FontFeatures, Decoration, or DecorationStyle, or DecorationStyle.

For example:

Text('Hello', style: TextStyle(fontSize: 14.0) + "Roboto" + Colors.red + FontStyle.italic);

Note: If you add null, that's not an error. It will simply return the same TextStyle. However, if you add an invalid type it will throw an error in RUN TIME.

Implementation

TextStyle operator +(Object? obj) => //
    (obj == null)
        ? this
        : copyWith(
            color: obj is Color ? obj : null,
            fontFamily: obj is String ? obj : null,
            fontSize: obj is FontSize ? obj.fontSize : null,
            fontWeight: obj is FontWeight ? obj : null,
            fontStyle: obj is FontStyle ? obj : null,
            textBaseline: obj is TextBaseline ? obj : null,
            locale: obj is Locale ? obj : null,
            shadows: obj is List<ui.Shadow> ? obj : null,
            fontFeatures: obj is List<ui.FontFeature> ? obj : null,
            decoration: obj is TextDecoration ? obj : null,
            decorationStyle: obj is TextDecorationStyle ? obj : null,
            height: obj is TextHeight ? obj.height : null,
          );