Closed
Description
class X {
final String y;
X({this.y});
}
produces in analyzer
Analyzing /tmp/test.dart...
error • The parameter 'y' can't have a value of 'null' because of its type, and no non-null default value is provided. • /tmp/test.dart:3:11 • missing_default_value_for_parameter
1 error found.
This error message seems to indicate that the only way to address this error is to provide non-null default value. However this is not true - you can either provide a default value or use required
keyword. I think this error message in both CFE and analyzer should be ammended to list both alternatives to be more user friendly.
This report is based on user report from Reddit
I think this also indicates that we might want to go through all error messages added in NNBD release and look at them from the perspective of UX and whether or not they are immediately actionable and clear even for the users who are encountering them for the first time. /cc @leafpetersen