in lib/src/rules/prefer_collection_literals.dart [93:128]
void visitInstanceCreationExpression(InstanceCreationExpression node) {
var constructorName = node.constructorName.name?.name;
// Lists, Maps.
if (_isList(node) || _isMap(node) || _isHashMap(node)) {
if (_shouldSkipLinkedHashLint(node, _isTypeHashMap)) {
return;
}
if (constructorName == null && node.argumentList.arguments.isEmpty) {
rule.reportLint(node);
}
return;
}
// Sets.
if (_isSet(node) || _isHashSet(node)) {
if (_shouldSkipLinkedHashLint(node, _isTypeHashSet)) {
return;
}
var args = node.argumentList.arguments;
if (constructorName == null) {
// Skip: LinkedHashSet(equals: (a, b) => false, hashCode: (o) => 13)
if (args.isEmpty) {
rule.reportLint(node);
}
} else if (constructorName == 'from' || constructorName == 'of') {
if (args.length != 1) {
return;
}
if (args.first is ListLiteral) {
rule.reportLint(node);
}
}
}
}