Dart Analyze logoDart Analyze/
DRT-W1540

Missing positional arguments in function invocationDRT-W1540

Major severityMajor
Bug Risk categoryBug Risk

The analyzer produces this diagnostic when a method or function invocation has fewer positional arguments than the number of required positional parameters.

Example

The following code produces this diagnostic because f declares two required parameters, but only one argument is provided:

void f(int a, int b) {}
void g() {
  f(0);
}

Common fixes

Add arguments corresponding to the remaining parameters:

void f(int a, int b) {}
void g() {
  f(0, 1);
}