extra_positional_arguments
Too many positional arguments: {0} expected, but {1} found.
Description
#The analyzer produces this diagnostic when a method or function invocation has more positional arguments than the method or function allows.
Example
#The following code produces this diagnostic because f
defines 2
parameters but is invoked with 3 arguments:
dart
void f(int a, int b) {}
void g() {
f(1, 2, 3);
}
Common fixes
#Remove the arguments that don't correspond to parameters:
dart
void f(int a, int b) {}
void g() {
f(1, 2);
}
除非另有说明,文档之所提及适用于 Dart 3.7.3 版本,本页面最后更新时间: 2025-05-08。 查看文档源码 或者 报告页面问题。