main_ first_ positional_ parameter_ type
Details about the 'main_first_positional_parameter_type' diagnostic produced by the Dart analyzer.
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) {}
除非另有说明,文档之所提及适用于 Dart 3.12.2 版本报告页面问题.