empty_ record_ type_ named_ fields_ list
The list of named fields in a record type can't be empty.
Description
#The analyzer produces this diagnostic when a record type has an empty list of named fields.
Example
#The following code produces this diagnostic because the record type has an empty list of named fields:
void f((int, int, {}) r) {}
Common fixes
#If the record is intended to have named fields, then add the types and names of the fields:
void f((int, int, {int z}) r) {}
If the record isn't intended to have named fields, then remove the curly braces:
void f((int, int) r) {}
Unless stated otherwise, the documentation on this site reflects Dart 3.9.2. Page last updated on 2025-9-1. View source or report an issue.