EN_raw_main_first_positional_parameter_type

  •                   Toolschevron_right
    
  •                   Diagnosticschevron_right
    
  •                   main_first_positional_parameter_type
    
                main_first_positional_parameter_type
    

Details about the 'main_first_positional_parameter_type' diagnostic produced by the Dart analyzer.

                more_vert
  •                       copyCopy link
    
  •                       bug_reportReport issue
    
                *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>`:
    
                  dart
    
void main(List<int> args) {}
                content_copy

              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>`:

                dart
void main(List<String> args) {}
                content_copy

If the function isn't an entry point, then change the name of the function:

                dart
void f(List<int> args) {}
                content_copy

Was this page's content helpful?

                    thumb_up
                    thumb_down

                Unless stated otherwise, the documentation on this site reflects Dart 3.13.3. Report an issue.