diff<E> static method
Future<List<Diff>>
diff<
E>( - List<E> newList,
- List<E> oldList, {
- ItemDiffUtil<E>? areItemsTheSame,
- bool? spawnIsolate,
})
Implementation
static Future<List<Diff>> diff<E>(
List<E> newList,
List<E> oldList, {
ItemDiffUtil<E>? areItemsTheSame,
bool? spawnIsolate,
}) {
eq = (a, b) => areItemsTheSame?.call(a, b) ?? a == b;
cq = (a, b) => false;
final args = _DiffArguments<E>(oldList, newList);
// We can significantly improve the performance by not spawning a new
// isolate for shorter lists.
spawnIsolate ??= (newList.length * oldList.length) > isolateThreshold;
if (spawnIsolate) {
return compute(_myersDiff, args);
}
return Future.value(_myersDiff(args));
}