We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Often classes contains getters without explicit setter (computed getter,...). In such case, generated code tries to assign value to them.
Run smartstruct 1.4.0 against this mapper:
class GetterTarget { final String name; final int age; int foo = 0; GetterTarget({ required this.name, required this.age, }); List<Object?> get props => [name, age]; bool get sample => false; } class GetterSource { final String name; final int age; int foo = 1; GetterSource({ required this.name, required this.age, }); List<Object?> get props => [name, age]; bool get sample => true; } @Mapper() abstract class GetterMapper { GetterTarget fromModel(GetterSource source); }
Generated mapping
class GetterMapperImpl extends GetterMapper { GetterMapperImpl() : super(); @override GetterTarget fromModel(GetterSource source) { final gettertarget = GetterTarget( name: source.name, age: source.age, ); gettertarget.foo = source.foo; // NO SETTER ! gettertarget.props = source.props.map((e) => e).toList(); // NO SETTER ! gettertarget.sample = source.sample; return gettertarget; } }
This can happen alot if project uses Equatable, where props, stringify and hashCode is used.
props
stringify
hashCode
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Often classes contains getters without explicit setter (computed getter,...). In such case, generated code tries to assign value to them.
Run smartstruct 1.4.0 against this mapper:
Generated mapping
This can happen alot if project uses Equatable, where
props
,stringify
andhashCode
is used.The text was updated successfully, but these errors were encountered: