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:
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);
}
Unless stated otherwise, the documentation on this site reflects Dart 3.7.3. Page last updated on 2025-05-08. View source or report an issue.