not_iterable_spread
Spread elements in list or set literals must implement 'Iterable'.
Description
#The analyzer produces this diagnostic when the static type of the
expression of a spread element that appears in either a list literal or a
set literal doesn't implement the type Iterable
.
Example
#The following code produces this diagnostic:
dart
var m = <String, int>{'a': 0, 'b': 1};
var s = <String>{...m};
Common fixes
#The most common fix is to replace the expression with one that produces an iterable object:
dart
var m = <String, int>{'a': 0, 'b': 1};
var s = <String>{...m.keys};
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。