I have model like this (simplified):
@immutable
class CountryModel {
final String name;
final String isoCode;
final String assetPath;
const CountryModel({
required this.name,
required this.isoCode,
}) : assetPath = 'assets/countries/$isoCode.PNG';
}
now I decided to migrate to freezed
but can't understand how to deal with fields like assetPath
I have a lot of models, whose initial values based on constructor parameters
my freezed model:
part 'country_model.freezed.dart';
@freezed
class CountryModel with _$CountryModel {
const factory CountryModel({
required String name,
required String isoCode,
}) = _CountryModel;
}
// : assetPath = 'assets/countries/$isoCode.PNG'
how to add assetPath field here?
so before migration to freezed if I create CountryModel
like this
CountryModel(name: 'name', isoCode: 'XX');
assetPath
value should be 'assets/countries/XX.PNG'