getDiff method

  1. @visibleForTesting
Map<String, String> getDiff(
  1. Comparable other
)
inherited

Implementation

@visibleForTesting
Map<String, String> getDiff(Comparable other) {
  final diff = <String, String>{};

  // Return if there are no differences.
  if (this == other) return diff;

  final otherProps = other.props;
  final length = props.length;

  for (int i = 0; i < length; i++) {
    final unit1 = props[i];
    final unit2 = otherProps[i];

    final differences = compareObjects(unit1, unit2);
    if (differences.isNotEmpty) {
      final propName = unit1?.runtimeType.toString() ??
          unit2?.runtimeType.toString() ??
          'N/A';
      diff[propName] = differences.toString();
    }
  }

  return diff;
}