assertTranslationsValid method Null safety

bool assertTranslationsValid(
  1. List<Translation> translations
)

Verifies that all translation have the same templated values (if so).

Implementation

static bool assertTranslationsValid(List<Translation> translations) {
  if (translations.length > 1) {
    final templatedValues = translations.first.templatedValues;
    for (var i = 1; i < translations.length; i++) {
      final current = translations[i];
      if (!const SetEquality()
          .equals(templatedValues.toSet(), current.templatedValues.toSet())) {
        return false;
      }
    }
  }

  return true;
}