diff method

List<ConfigDiff> diff(
  1. ConfigScope scope1,
  2. ConfigScope scope2
)

Compare configuration between two scopes and return the differences.

Implementation

List<ConfigDiff> diff(ConfigScope scope1, ConfigScope scope2) {
  final map1 = _store[scope1]!;
  final map2 = _store[scope2]!;
  final allKeys = {...map1.keys, ...map2.keys};
  final diffs = <ConfigDiff>[];

  for (final key in allKeys) {
    final v1 = map1[key];
    final v2 = map2[key];
    if (v1 != v2) {
      diffs.add(
        ConfigDiff(key: key, oldValue: v1, newValue: v2, scope: scope1),
      );
    }
  }
  return diffs;
}