that's awesome, thanks! equatable / freezed gen co...
# flutter
j
that's awesome, thanks! equatable / freezed gen could be a cherry on top
o
yeah I'm sure generating the boilerplate for both is much easier -- though I haven't used either before to understand how the output should look like and any special cases..
all one needs is to create a builder for freezed like this one: https://github.com/osaxma/schema-dart/blob/main/lib/src/data_class_builder.dart then an option can be added to the command so the user chooses which builder -- e.g.
--builder=freezed
.
The next thing that I'm planning to do, once I get a chance, is to generate types for functions by inspecting their arguments and return type...
j
very very cool! not sure i can help, but this is a good explanation of why equatable and freezed is almost mandatory:
Being able to compare objects in Dart often involves having to override the == operator as well as hashCode. Not only is it verbose and tedious, but failure to do so can lead to inefficient code which does not behave as we expect. By default, == returns true if two objects are the same instance.
o
This is already generated by the package btw -- equality/hashcode, serialization (fromJson, toJson), and copyWith. Look at the output examples here: https://github.com/osaxma/schema-dart/tree/main/example/sample_output
j
awesome! i just pasted the desc from the package info