calculateFirstUnMatchedIndex function

int calculateFirstUnMatchedIndex({
  1. required List<String> currentList,
  2. required List<String> oldList,
})

Implementation

int calculateFirstUnMatchedIndex(
    {required List<String> currentList, required List<String> oldList}) {
  if (currentList.length < oldList.length ||
      currentList.length > oldList.length) {
    return 0;
  } else {
    for (int i = 0; i < oldList.length; i++) {
      if (currentList[i] != oldList[i]) {
        return i;
      }
    }
  }

  return 0;
}