copyAndReplace static method

List<StyleFamilyState> copyAndReplace(
  1. List<StyleFamilyState> toReplace,
  2. StyleFamilyState replaceWith
)

Implementation

static List<StyleFamilyState> copyAndReplace(
    List<StyleFamilyState> toReplace, StyleFamilyState replaceWith) {
  List<StyleFamilyState> newFamilies = [];
  for (var styleFamilyState in toReplace) {
    if (styleFamilyState.styleFamily.familyName != replaceWith.familyName()) {
      newFamilies.add(styleFamilyState);
    }
  }
  newFamilies.add(replaceWith);
  return newFamilies;
}