This PR aims to add a toString() override for the generated models. This ensures that whenever the model is printed in the console, it will return the actual data of the model:
The changes are required only when the style is basic and json_serializable. Freezed already has its own implementation of the toString() override so it is not required when the developer uses this style. Therefore, only the {{~ basic_model }} and {{~ serializable_model }} have the new toString method added ({{~ to_string }}).
There have been additional changes inside the pre_gen.dart file to identify when the parameters end. This is needed to ensure that the resulting toString() text does not have a trailing , and is nicely formatted.
Type of Change
[x] โจ New feature (non-breaking change which adds functionality)
[ ] ๐ ๏ธ Bug fix (non-breaking change which fixes an issue)
[ ] โ Breaking change (fix or feature that would cause existing functionality to change)
Brick
Status
READY
Breaking Changes
NO
Description
This PR aims to add a
toString()
override for the generated models. This ensures that whenever the model is printed in the console, it will return the actual data of the model:instead of:
The changes are required only when the style is basic and json_serializable. Freezed already has its own implementation of the
toString()
override so it is not required when the developer uses this style. Therefore, only the{{~ basic_model }}
and{{~ serializable_model }}
have the new toString method added ({{~ to_string }}
).There have been additional changes inside the
pre_gen.dart
file to identify when the parameters end. This is needed to ensure that the resultingtoString()
text does not have a trailing,
and is nicely formatted.Type of Change