Skip to main content

not_enough_positional_arguments

1 positional argument expected by '{0}', but 0 found.

1 positional argument expected, but 0 found.

{0} positional arguments expected by '{2}', but {1} found.

{0} positional arguments expected, but {1} found.

Description

#

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:

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

Common fixes

#

Add arguments corresponding to the remaining parameters:

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