xsahil03x / super_enum

Create super-powered dart enums similar to sealed classes in Kotlin
https://pub.dev/packages/super_enum
MIT License
116 stars 13 forks source link

use const constructor #41

Closed dennis-szymanski closed 4 years ago

dennis-szymanski commented 4 years ago

Hey,

I really love your package ! Thanks a lot for putting so much effort into it !

I only have a super small suggestion for improvement: You have const constructors but you don't use them in the factorys (for @object's). For example:

@immutable
class Empty extends ExampleState {
  const Empty._() : super(ExampleState .Empty);

  factory Empty() {
    _instance ??= Empty._(); // -> _instance ??= const Empty._()
    return _instance;
  }

  static Empty _instance;
}

There is no problem in that, but my linting settings mark this as an warning :)