I am currently following resocoders clean architecture in which he highly recommends to use Equatable for basic dataholding classes that will be compared in the future. The thing is my class will look something like this:
class Person extends Equatable {
final String name;
final List<AlterEgo> alterEgos;
Person({@required name, @required alterEgos}):super([name, alterEgos]);
@override
List<Object> get props => [name, alterEgos];
}
class AlterEgo extends Equatable {
final String name;
final String superPower;
AlterEgo({@required name, @required superPower}):super([name, superPower]);
@override
List<Object> get props => [name, superPower];
}
void main(){
Person("Clark", <AlterEgo>[AlterEgo("Superman", "Flying")]) == Person("Clark", <AlterEgo>[AlterEgo("Superman", "Flying")]) //true
}
The thing is when I write the constructors the IDE complains that lists aren't comparable. I am kind of lost as to which functions/classes to define now to get a list of objects made from primitive types to work with equatable. The documentation of the package also seems to omit this usecase, only stating that Equatable only works with immutable types. However I wouldn't mind the list being immutable at all.
EDIT: completed example. On mobile right now, cannot test it right away.