Using @Default annotation and required together .... #1032
Unanswered
stephenhauck
asked this question in
Q&A
Replies: 1 comment 1 reply
-
|
This is intended, take this NON-freezed as an example: class DataClass {
final String name;
final int id;
final double value;
DataClass({
required this.name,
required this.id,
this.value = 100.0, // you can't add a `required` on value
});
} |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When I try to make a field / property have a default with the @default annotation it does not allow me to also mark it as required ...
Just confirming this is because by having a default it will always have a value ?
Beta Was this translation helpful? Give feedback.
All reactions