simc / dartx

Superpowers for Dart. Collection of useful static extension methods.
https://pub.dev/packages/dartx
Apache License 2.0
1.06k stars 88 forks source link

equals extension for deep equality of iterables #52

Open machinescream opened 4 years ago

machinescream commented 4 years ago

Please add equals extensions based on ListEquality and so on...

simc commented 4 years ago

~It is not possible to create an extension named equals because every object already has a method with that name.~ There already exists the .contentEquals() extension for iterables (and lists).

passsy commented 4 years ago

I like the idea but I'm unsure if we should use ListEquality or DeepCollectionEquality. Please describe your use case and we can see which API fits best.

Alternatively you could use collections which support equality by default: BuildList or KtList

machinescream commented 4 years ago

You probably mean == operator, I didn't see a equals in Iterable, List, etc. .contentEquals() is ok.

simc commented 4 years ago

You probably mean == operator

Yes, my bad. Is the contentEquals() method not suggested for auto-completion if you type "equals"?

machinescream commented 4 years ago

To be honest I am against about to use different collections. I prefer use core lib with extensions =)

simc commented 4 years ago

Does contentEquals() solve your problem or do you need more options / deep collection equality?

machinescream commented 4 years ago

Well, contentEquals solved my problem, but I think will be nice to have deep collection equality as well.