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);
}
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.