merge<T extends FlameTextStyle> static method

T? merge<T extends FlameTextStyle>(
  1. T? style1,
  2. T? style2
)

Merges two FlameTextStyles together, preferring the properties of style2 if present, falling back to the properties of style1.

Implementation

static T? merge<T extends FlameTextStyle>(T? style1, T? style2) {
  if (style1 == null) {
    return style2;
  } else if (style2 == null) {
    return style1;
  } else {
    assert(style1.runtimeType == style2.runtimeType);
    return style1.copyWith(style2) as T;
  }
}