empty_record_literal_with_comma
A record literal without fields can't have a trailing comma.
Description
#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:
dart
var r = (,);
Common fixes
#If the record is intended to be empty, then remove the comma:
dart
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:
dart
var r = (3, 4);
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。