Closed
Description
When we have an Enum class that implements a mixin, the analyzer will accept any uses of that enum as it would any class, but when tried to run the code, the compiler will complain something along the lines of
Error: A value of type 'Enum?' can't be assigned to a variable of type 'LinkEnum?'.
Even if the variable was originally of LinkEnum,
Casting the variable to LinkEnum works, but raises an unnecessary_cast
warning.
Example code below:
mixin LinkEnum on Enum {
String get link;
}
enum Websites implements LinkEnum {
google('google.com')
;
const Websites(this.link);
final String link;
}
Dart SDK version: 2.18.4 (stable) (Tue Nov 1 15:15:07 2022 +0000) on "macos_arm64"