LukasPoque / s3i_flutter

A library that makes it easy to communicate with the S³I (Smart Systems Service Infrastructure of the KWH4.0)
https://pub.dev/packages/s3i_flutter
MIT License
4 stars 1 forks source link

Add comparison method to directory thing and sub-components #1

Open LukasPoque opened 3 years ago

LukasPoque commented 3 years ago

It should be easy to compare two things or sub-components (value, link, etc.). => Override == operator and hashcode.

LukasPoque commented 2 years ago

Overriding == and hashcode is a bad idea on mutable objects like thing (https://dart-lang.github.io/linter/lints/avoid_equals_and_hash_code_on_mutable_classes.html).

LukasPoque commented 2 years ago

If we decide to make things immutable we should use https://pub.dev/packages/equatable instead of overriding the normal comparison methods.

LukasPoque commented 2 years ago

IMO we should make all data classes immutable. They should have a copyWith()-Method to modify their attributes. This allows us to compare and use them in collections and other data structures where only immutable objects should be stored.