mergeStyles function

Map<String, Object?> mergeStyles(
  1. Map<String, Object?> first,
  2. Map<String, Object?> second, [
  3. Map<String, Object?> third = const {},
  4. Map<String, Object?> fourth = const {},
  5. Map<String, Object?> fifth = const {},
])

Combines style maps from left to right, ignoring null values.

Implementation

Map<String, Object?> mergeStyles(
  Map<String, Object?> first,
  Map<String, Object?> second, [
  Map<String, Object?> third = const {},
  Map<String, Object?> fourth = const {},
  Map<String, Object?> fifth = const {},
]) {
  return {
    for (final style in [first, second, third, fourth, fifth])
      for (final entry in style.entries)
        if (entry.value != null && entry.key != '_cssText')
          entry.key: entry.value,
  };
}