difference method

(String, (Object?, Object?))? difference(
  1. Transition other
)

Implementation

(String, (Object?, Object?))? difference(Transition other) {
  if (action != other.action) {
    return ('doAction', (action, other.action));
  }

  if (event != other.event) {
    return ('event', (event, other.event));
  }

  if (guard != other.guard) {
    return ('guard', (guard, other.guard));
  }

  if (source != other.source) {
    return ('source', (source, other.source));
  }

  if (target != other.target) {
    return ('target', (target, other.target));
  }

  final map1 = arguments;
  final map2 = other.arguments;
  var isEquals = false;
  if (map1.length == map2.length) {
    isEquals = true;
    for (final entry in map1.entries) {
      final key = entry.key;
      final value = entry.value;
      final value2 = map2[key];
      if (value2 == null || value2 != value) {
        isEquals = false;
        break;
      }
    }
  }

  if (!isEquals) {
    return ('arguments', (map1, map2));
  }

  return null;
}