-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow const constructor with mixins that have getter-only fields #37810
Comments
It shouldn't happen. This is an implementation bug. I'll move it to the SDK repository. Simple reproduction: class C {
const C();
}
mixin M {
int get foo;DART_CONFIGURATION=ReleaseX64 .../sdk/bin/dartanalyzer_developer --dart-sdk=/usr/local/google/home/lrn/dart/co/sdk/sdk cmf.dart
}
class S extends C with M {
const S();
int get foo => 42;
}
main() {
const S().foo;
} gives the following error from the analyzer:
It should not. The common front-end does not give any error.DART_CONFIGURATION=ReleaseX64 .../sdk/bin/dartanalyzer_developer --dart-sdk=/usr/local/google/home/lrn/dart/co/sdk/sdk cmf.dart |
Any news? |
Hi all, |
Any news about? |
Originally posted at google/built_value.dart#694
I'm getting
const_constructor_with_mixin_with_field
when using this mixin:I have other code in the mixin that depends on those fields, which are defined in the subclass.
Since I'm not actually defining any fields in the mixin itself, it seems like this error shouldn't necessarily happen.
Shouldn't getter-only fields be treated similarly to functions?
Edit: Forgot to add my use case for this...
I'm using Flutter with a
BottomNavigationBar
and separate navigation within each tab.As a result, I'd like to keep all of this related information with the
EnumClass
because it makes more sense structurally to me than to have functions within the various Widgets.The text was updated successfully, but these errors were encountered: