Skip to content

Instantly share code, notes, and snippets.

@Sovann72
Last active February 28, 2024 08:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sovann72/a854e5f737d3e815cac9947f75f5d2e7 to your computer and use it in GitHub Desktop.
Save Sovann72/a854e5f737d3e815cac9947f75f5d2e7 to your computer and use it in GitHub Desktop.
check-equality-of-two-list
// https://stackoverflow.com/a/22333042/15149752
import 'package:collection/collection.dart';
List<String> otherList = ['foo', 'bar', 'baz'];
List<String> something = ['bar', 'baz', 'foo'];
void checkTwoListForEquality(List<String> firstList, List<String> secList) {
Function unOrdDeepEq = const DeepCollectionEquality.unordered().equals;
final result = unOrdDeepEq.call(firstList, secList);
print(result);
}
void main() {
checkTwoListForEquality(something, otherList);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment