main_ first_ positional_ parameter_ type
The
type
of
the
first
positional
parameter
of
the 'main'
function
must
be
a
supertype
of 'List
Description
#
The analyzer produces this diagnostic when the first positional parameter
of a function named
main
isn't a supertype of
List<String>
.
Example
#
The following code produces this diagnostic because
List<int>
isn't a
supertype of
List<String>
:
void main(List<int> args) {}
Common fixes
#
If the function is an entry point, then change the type of the first
positional parameter to be a supertype of
List<String>
:
void main(List<String> args) {}
If the function isn't an entry point, then change the name of the function:
void f(List<int> args) {}
Unless stated otherwise, the documentation on this site reflects Dart 3.9.2. Page last updated on 2025-9-4. View source or report an issue.