Dart Analyze logoDart Analyze/
DRT-W1319

A record literal without fields can't have a trailing commaDRT-W1319

Major severityMajor
Bug Risk categoryBug Risk

The analyzer produces this diagnostic when a record literal that has no fields has a trailing comma. Empty record literals can't contain a comma.

Example

The following code produces this diagnostic because the empty record literal has a trailing comma:

var r = (,);

Common fixes

If the record is intended to be empty, then remove the comma:

var r = ();

If the record is intended to have one or more fields, then add the expressions used to compute the values of those fields:

var r = (3, 4);