---
title: "Comment by Yohanes Bandung on \"Everything you need to know about Enum with Flutter and Dart\" | Hashnode"
description: "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 e"
url: "https://hashnode.com/posts/everything-you-need-to-know-about-enum-with-flutter-and-dart/651bfdf02198838db882ff54/comment/651cfc7dc64d5e99595a0580"
---

[Discussion](https://hashnode.com/posts/everything-you-need-to-know-about-enum-with-flutter-and-dart/651bfdf02198838db882ff54)

Comment [Everything you need to know about Enum with Flutter and Dart](https://hashnode.com/posts/everything-you-need-to-know-about-enum-with-flutter-and-dart/651bfdf02198838db882ff54)

[Yohanes Bandung](https://hashnode.com/@ybbond)

[Oct 4, 2023](https://hashnode.com/posts/everything-you-need-to-know-about-enum-with-flutter-and-dart/651bfdf02198838db882ff54/comment/651cfc7dc64d5e99595a0580)

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 '';
    }
  }
}
```

[Loïc Yabili](https://hashnode.com/@lyabs243)

[Oct 4, 2023](https://hashnode.com/posts/everything-you-need-to-know-about-enum-with-flutter-and-dart/651bfdf02198838db882ff54/comment/651cfc7dc64d5e99595a0580#reply-651d29baf561999bd60fa18f)

Thank you for your comment.

If the enum is nullable it can't be used without the null aware operator '?', for me there is not need to add a case for that, you can directly use:

`final String weekDayShortName = weekDay?.shortName?? '';`
