Prefs constructor

Prefs({
  1. List<Pref> preferences = const [],
})

Implementation

Prefs({this.preferences = const []}) {
  Map<String, Pref> prefs = {};
  for (Pref p in preferences) {
    if (!prefs.containsKey(p.prefKey)) {
      prefs[p.prefKey] = p;
    } else {
      // ignore: avoid_print
      print('WARNING: Duplicate prefKey - preference discarded.');
    }
  }
  preferences = prefs.values.toList();
}