record_ type_ zero_ fields_ but_ trailing_ comma
Details about the 'record_type_zero_fields_but_trailing_comma' diagnostic produced by the Dart analyzer.
A record type without fields can't have a trailing comma.
Description
#The analyzer produces this diagnostic when a record type that has no fields has a trailing comma. Empty record types can't contain a comma.
Example
#The following code produces this diagnostic because the empty record type has a trailing comma:
void f((,) r) {}
Common fixes
#If the record type is intended to be empty, then remove the comma:
void f(() r) {}
If the record type is intended to have one or more fields, then add the types of those fields:
void f((int, int) r) {}
Unless stated otherwise, the documentation on this site reflects Dart 3.11.0. Report an issue.