hasMapDifference<K, V> static method

bool hasMapDifference<K, V>(
  1. Map<K, V> initialMap,
  2. Map<K, V> currentMap, {
  3. List<K> keys = const [],
})

Implementation

static bool hasMapDifference<K, V>(
  Map<K, V> initialMap,
  Map<K, V> currentMap, {
  List<K> keys = const [],
}) {
  if (keys.isEmpty) return !mapEquals(initialMap, currentMap);
  for (final key in keys) {
    final V? current = currentMap[key];
    final V? initial = initialMap[key];
    if (current != initial) {
      printRed(
        "Difference found on $key(initial, current): $initial(${initial.runtimeType}), $current(${current.runtimeType})",
      );
      return true;
    }
  }
  return false;
}