Great information!
We get the ability to add default value if mapping to enum use non-assigned value.
do you have any idea how we can get default value if the enum is nullable? for example:
final WeekDay? weekDay = null;
// I want to get empty string
final String weekDayShortName = weekDay.shortName;
previously, I use something like this:
enum WeekDay {
monday
}
// extend nullable WeekDay
extension WeekDayExtension on WeekDay? {
String get shortName {
switch (this) {
case WeekDay.monday:
return 'Mon';
case null:
return '';
}
}
}