title: Dart migration tool errors on generated files
body: <p>I'm trying to use <code>dart migrate</code> to upgrade dart to null safety, but when I do, I get tons of errors in my generated files:</p>
  <pre><code>benjaminfarquhar@Benjamins-MacBook-Pro vepo_front_end % dart migrate                        
  Warning: `dart pub outdated --mode=null-safety` exited with exit code 69 and stderr:
  
  Package doesn't exist (the Flutter SDK is not available).
  
  Migrating /Users/benjaminfarquhar/dev/vepo_front_end
  
  Note: more than one project found; migrating the top-level project.
  
  Analyzing project...
  [-                                                                                                                             [----------------------------------------------------------------------------------------------------------------------------/]
  82 analysis issues found:
    error • Target of URI doesn't exist: 'package:flutter_data/flutter_data.dart' at lib/main.data.dart:4:8 • (uri_does_not_exist)
    error • Target of URI doesn't exist: 'package:provider/provider.dart' at lib/main.data.dart:7:8 • (uri_does_not_exist)
    error • Target of URI doesn't exist: 'package:provider/single_child_widget.dart' at lib/main.data.dart:8:8 • (uri_does_not_exist)
    error • Undefined class 'ConfigureRepositoryLocalStorage' at lib/main.data.dart:10:1 • (undefined_class)
    error • Undefined class 'FutureFn' at lib/main.data.dart:11:7 • (undefined_class)
    error • Undefined name 'hiveLocalStorageProvider' at lib/main.data.dart:15:10 • (undefined_identifier)
    error • Undefined name 'RiverpodAlias' at lib/main.data.dart:15:56 • (undefined_identifier)
    error • Missing parameter type for '_' at lib/main.data.dart:16:8 • (implicit_dynamic_parameter)
    error • The function 'HiveLocalStorage' isn't defined at lib/main.data.dart:16:14 • (undefined_function)
    error • Undefined class 'RepositoryInitializerProvider' at lib/main.data.dart:20:1 • (undefined_class)
    error • The function 'RepositoryInitializerArgs' isn't defined at lib/main.data.dart:23:7 • (undefined_function)
    error • Missing variable type for '_repositoryInitializerProviderFamily' at lib/main.data.dart:26:7 • (implicit_dynamic_variable)
    error • Undefined name 'RiverpodAlias' at lib/main.data.dart:26:46 • (undefined_identifier)
    error • The name 'RepositoryInitializer' isn't a type so it can't be used as a type argument at lib/main.data.dart:27:5 • (non_type_as_type_argument)
    error • The name 'RepositoryInitializerArgs' isn't a type so it can't be used as a type argument at lib/main.data.dart:27:28 • (non_type_as_type_argument)
    error • Missing parameter type for 'ref' at lib/main.data.dart:27:56 • (implicit_dynamic_parameter)
    error • Missing parameter type for 'args' at lib/main.data.dart:27:61 • (implicit_dynamic_parameter)
    error • The name 'RemoteAdapter' isn't a type so it can't be used as a type argument at lib/main.data.dart:28:39 • (non_type_as_type_argument)
    error • The function 'RepositoryInitializer' isn't defined at lib/main.data.dart:30:10 • (undefined_function)
    error • The name 'SingleChildWidget' isn't a type so it can't be used as a type argument at lib/main.data.dart:33:6 • (non_type_as_type_argument)
    error • Undefined class 'FutureFn' at lib/main.data.dart:34:6 • (undefined_class)
    error • Missing type argument for list literal at lib/main.data.dart:39:10 • (implicit_dynamic_list_literal)
    error • Missing parameter type for '_' at lib/main.data.dart:41:16 • (implicit_dynamic_parameter)
    error • The function 'ProviderContainer' isn't defined at lib/main.data.dart:41:22 • (undefined_function)
    error • Missing type argument for list literal at lib/main.data.dart:41:51 • (implicit_dynamic_list_literal)
    error • The name 'RepositoryInitializer' isn't a type so it can't be used as a type argument at lib/main.data.dart:46:22 • (non_type_as_type_argument)
    error • Missing parameter type for 'context' at lib/main.data.dart:47:16 • (implicit_dynamic_parameter)
    error • Missing variable type for 'init' at lib/main.data.dart:48:15 • (implicit_dynamic_variable)
    error • The name 'ProviderContainer' isn't a type so it can't be used as a type argument at lib/main.data.dart:49:33 • (non_type_as_type_argument)
    error • Undefined name 'internalLocatorFn' at lib/main.data.dart:52:9 • (undefined_identifier)
    error • Missing parameter type for 'provider' at lib/main.data.dart:52:30 • (implicit_dynamic_parameter)
    error • Missing parameter type for 'context' at lib/main.data.dart:52:40 • (implicit_dynamic_parameter)
    error • The name 'ProviderContainer' isn't a type so it can't be used as a type argument at lib/main.data.dart:53:27 • (non_type_as_type_argument)
    error • Missing type arguments for generic method 'map&lt;K2, V2&gt;' at lib/src/application/entities/forms/add_vegan_item/add_grocery_item/add_grocery_item_form_entity.g.dart:15:77 • (implicit_dynamic_method)
    error • Missing parameter type for 'k' at lib/src/application/entities/forms/add_vegan_item/add_grocery_item/add_grocery_item_form_entity.g.dart:16:14 • (implicit_dynamic_parameter)
    error • Missing parameter type for 'e' at lib/src/application/entities/forms/add_vegan_item/add_grocery_item/add_grocery_item_form_entity.g.dart:16:17 • (implicit_dynamic_parameter)
    error • Missing type arguments for generic type 'MapEntry&lt;String, dynamic&gt;' at lib/src/application/entities/forms/add_vegan_item/add_grocery_item/add_grocery_item_form_entity.g.dart:16:23 • (implicit_dynamic_type)
    error • Missing type arguments for generic method 'map&lt;K2, V2&gt;' at lib/src/application/entities/forms/add_vegan_item/add_grocery_item/add_grocery_item_form_entity.g.dart:20:74 • (implicit_dynamic_method)
    error • Missing parameter type for 'k' at lib/src/application/entities/forms/add_vegan_item/add_grocery_item/add_grocery_item_form_entity.g.dart:21:14 • (implicit_dynamic_parameter)
    error • Missing parameter type for 'e' at lib/src/application/entities/forms/add_vegan_item/add_grocery_item/add_grocery_item_form_entity.g.dart:21:17 • (implicit_dynamic_parameter)
    error • Missing type arguments for generic type 'MapEntry&lt;String, dynamic&gt;' at lib/src/application/entities/forms/add_vegan_item/add_grocery_item/add_grocery_item_form_entity.g.dart:21:23 • (implicit_dynamic_type)
    error • Missing type arguments for generic method 'map&lt;K2, V2&gt;' at lib/src/application/entities/forms/add_vegan_item/add_vegan_item_form_entity.g.dart:18:77 • (implicit_dynamic_method)
    error • Missing parameter type for 'k' at lib/src/application/entities/forms/add_vegan_item/add_vegan_item_form_entity.g.dart:19:14 • (implicit_dynamic_parameter)
    error • Missing parameter type for 'e' at lib/src/application/entities/forms/add_vegan_item/add_vegan_item_form_entity.g.dart:19:17 • (implicit_dynamic_parameter)
    error • Missing type arguments for generic type 'MapEntry&lt;String, dynamic&gt;' at lib/src/application/entities/forms/add_vegan_item/add_vegan_item_form_entity.g.dart:19:23 • (implicit_dynamic_type)
    error • Missing type arguments for generic method 'map&lt;K2, V2&gt;' at lib/src/application/entities/forms/add_vegan_item/add_vegan_item_form_entity.g.dart:23:75 • (implicit_dynamic_method)
    error • Missing parameter type for 'k' at lib/src/application/entities/forms/add_vegan_item/add_vegan_item_form_entity.g.dart:24:14 • (implicit_dynamic_parameter)
    error • Missing parameter type for 'e' at lib/src/application/entities/forms/add_vegan_item/add_vegan_item_form_entity.g.dart:24:17 • (implicit_dynamic_parameter)
    error • Missing type arguments for generic type 'MapEntry&lt;String, dynamic&gt;' at lib/src/application/entities/forms/add_vegan_item/add_vegan_item_form_entity.g.dart:24:23 • (implicit_dynamic_type)
    error • Missing parameter type for 'e' at lib/src/application/entities/forms/add_vegan_item/add_vegan_item_form_entity.g.dart:30:16 • (implicit_dynamic_parameter)
    error • Missing type arguments for generic method 'map&lt;K2, V2&gt;' at lib/src/application/entities/forms/add_vegan_item/add_vegan_item_form_entity.g.dart:32:55 • (implicit_dynamic_method)
    error • Missing parameter type for 'k' at lib/src/application/entities/forms/add_vegan_item/add_vegan_item_form_entity.g.dart:33:18 • (implicit_dynamic_parameter)
    error • Missing parameter type for 'e' at lib/src/application/entities/forms/add_vegan_item/add_vegan_item_form_entity.g.dart:33:21 • (implicit_dynamic_parameter)
    error • Missing type arguments for generic type 'MapEntry&lt;String, dynamic&gt;' at lib/src/application/entities/forms/add_vegan_item/add_vegan_item_form_entity.g.dart:33:27 • (implicit_dynamic_type)
    error • Missing parameter type for 'e' at lib/src/application/entities/forms/add_vegan_item/add_vegan_item_form_entity.g.dart:37:16 • (implicit_dynamic_parameter)
    error • Missing type arguments for generic method 'map&lt;K2, V2&gt;' at lib/src/application/entities/forms/add_vegan_item/add_vegan_item_form_entity.g.dart:39:55 • (implicit_dynamic_method)
    error • Missing parameter type for 'k' at lib/src/application/entities/forms/add_vegan_item/add_vegan_item_form_entity.g.dart:40:18 • (implicit_dynamic_parameter)
    error • Missing parameter type for 'e' at lib/src/application/entities/forms/add_vegan_item/add_vegan_item_form_entity.g.dart:40:21 • (implicit_dynamic_parameter)
    error • Missing type arguments for generic type 'MapEntry&lt;String, dynamic&gt;' at lib/src/application/entities/forms/add_vegan_item/add_vegan_item_form_entity.g.dart:40:27 • (implicit_dynamic_type)
    error • Missing type arguments for generic method 'map&lt;K2, V2&gt;' at lib/src/application/entities/forms/user_registration/user_registration_form_entity.g.dart:20:47 • (implicit_dynamic_method)
    error • Missing parameter type for 'k' at lib/src/application/entities/forms/user_registration/user_registration_form_entity.g.dart:21:14 • (implicit_dynamic_parameter)
    error • Missing parameter type for 'e' at lib/src/application/entities/forms/user_registration/user_registration_form_entity.g.dart:21:17 • (implicit_dynamic_parameter)
    error • Missing type arguments for generic type 'MapEntry&lt;String, dynamic&gt;' at lib/src/application/entities/forms/user_registration/user_registration_form_entity.g.dart:21:23 • (implicit_dynamic_type)
    error • Missing parameter type for 'e' at lib/src/application/entities/search_params/establishments/establishments_search_params_entity.g.dart:20:44 • (implicit_dynamic_parameter)
    error • Missing parameter type for 'e' at lib/src/domain/entities/vegan_item/grocery_item/grocery_item_domain_entity.g.dart:19:16 • (implicit_dynamic_parameter)
    error • Missing type arguments for generic method 'map&lt;K2, V2&gt;' at lib/src/domain/entities/vegan_item/grocery_item/grocery_item_domain_entity.g.dart:21:55 • (implicit_dynamic_method)
    error • Missing parameter type for 'k' at lib/src/domain/entities/vegan_item/grocery_item/grocery_item_domain_entity.g.dart:22:18 • (implicit_dynamic_parameter)
    error • Missing parameter type for 'e' at lib/src/domain/entities/vegan_item/grocery_item/grocery_item_domain_entity.g.dart:22:21 • (implicit_dynamic_parameter)
    error • Missing type arguments for generic type 'MapEntry&lt;String, dynamic&gt;' at lib/src/domain/entities/vegan_item/grocery_item/grocery_item_domain_entity.g.dart:22:27 • (implicit_dynamic_type)
    error • Missing type arguments for generic method 'map&lt;K2, V2&gt;' at lib/src/domain/entities/vegan_item/menu_item/menu_item_domain_entity.g.dart:17:75 • (implicit_dynamic_method)
    error • Missing parameter type for 'k' at lib/src/domain/entities/vegan_item/menu_item/menu_item_domain_entity.g.dart:18:14 • (implicit_dynamic_parameter)
    error • Missing parameter type for 'e' at lib/src/domain/entities/vegan_item/menu_item/menu_item_domain_entity.g.dart:18:17 • (implicit_dynamic_parameter)
    error • Missing type arguments for generic type 'MapEntry&lt;String, dynamic&gt;' at lib/src/domain/entities/vegan_item/menu_item/menu_item_domain_entity.g.dart:18:23 • (implicit_dynamic_type)
    error • Missing parameter type for 'e' at lib/src/domain/entities/vegan_item/menu_item/menu_item_domain_entity.g.dart:24:16 • (implicit_dynamic_parameter)
    error • Missing type arguments for generic method 'map&lt;K2, V2&gt;' at lib/src/domain/entities/vegan_item/menu_item/menu_item_domain_entity.g.dart:26:55 • (implicit_dynamic_method)
    error • Missing parameter type for 'k' at lib/src/domain/entities/vegan_item/menu_item/menu_item_domain_entity.g.dart:27:18 • (implicit_dynamic_parameter)
    error • Missing parameter type for 'e' at lib/src/domain/entities/vegan_item/menu_item/menu_item_domain_entity.g.dart:27:21 • (implicit_dynamic_parameter)
    error • Missing type arguments for generic type 'MapEntry&lt;String, dynamic&gt;' at lib/src/domain/entities/vegan_item/menu_item/menu_item_domain_entity.g.dart:27:27 • (implicit_dynamic_type)
    error • The method '_$_$_SelectListItemFromJson' isn't defined for the type '_$_SelectListItem' at lib/src/presentation/widgets/form_fields/select_fields/common/select_list_item/select_list_item.freezed.dart:116:7 • (undefined_method)
    error • A value of type 'dynamic' can't be returned from constructor '_$_SelectListItem.fromJson' because it has a return type of '_$_SelectListItem' at lib/src/presentation/widgets/form_fields/select_fields/common/select_list_item/select_list_item.freezed.dart:116:7 • (return_of_invalid_type)
    error • The method '_$_$_SelectListItemToJson' isn't defined for the type '_$_SelectListItem' at lib/src/presentation/widgets/form_fields/select_fields/common/select_list_item/select_list_item.freezed.dart:151:12 • (undefined_method)
    error • A value of type 'dynamic' can't be returned from method 'toJson' because it has a return type of 'Map&lt;String, dynamic&gt;' at lib/src/presentation/widgets/form_fields/select_fields/common/select_list_item/select_list_item.freezed.dart:151:12 • (return_of_invalid_type)
  </code></pre>
  <p>my flutter doctor:</p>
  <pre><code>benjaminfarquhar@Benjamins-MacBook-Pro vepo_front_end % flutter doctor
  Doctor summary (to see all details, run flutter doctor -v):
  [✓] Flutter (Channel stable, 2.0.1, on macOS 11.2.1 20D74 darwin-x64, locale en-NZ)
  [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
  [✓] Xcode - develop for iOS and macOS
  [✓] Chrome - develop for the web
  [✓] Android Studio (version 4.0)
  [✓] VS Code (version 1.53.2)
  [✓] Connected device (5 available)
  </code></pre>
  <p>I tried running it with <code>--ignore-errors</code> but it still had an exception:</p>
  <pre><code>Generating migration suggestions...
  [-                                                                                                                             [\                                                                                                                             [|                                                                                                                             [---                                                                                                                          ]Aborting migration due to an exception.  This may be due to a bug in
  the migration tool, or it may be due to errors in the source code
  being migrated.  If possible, try to fix errors in the source code and
  re-try migrating.  If that doesn't work, consider filing a bug report
  at:
  
  https://github.com/dart-lang/sdk/issues/new
  To attempt to perform migration anyway, you may re-run with
  --ignore-exceptions.
  
  Exception details:
  
  Bad state: Missing declarated type annotation in /Users/benjaminfarquhar/dev/vepo_front_end/lib/main.data.dart; for String
  
  #0      Variables.decoratedTypeAnnotation (package:nnbd_migration/src/variables.dart:113:7)
  #1      EdgeBuilder.visitTypeName (package:nnbd_migration/src/edge_builder.dart:1729:26)
  #2      TypeNameImpl.accept (package:analyzer/src/dart/ast/ast.dart:10141:49)
  #3      EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2104:22)
  #4      EdgeBuilder.visitNode (package:nnbd_migration/src/edge_builder.dart:1258:9)
  #5      GeneralizingAstVisitor.visitTypeArgumentList (package:analyzer/dart/ast/visitor.dart:564:53)
  #6      TypeArgumentListImpl.accept (package:analyzer/src/dart/ast/ast.dart:10022:49)
  #7      TypeNameImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:10146:21)
  #8      EdgeBuilder.visitTypeName (package:nnbd_migration/src/edge_builder.dart:1764:16)
  #9      TypeNameImpl.accept (package:analyzer/src/dart/ast/ast.dart:10141:49)
  #10     EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2104:22)
  #11     EdgeBuilder.visitNode (package:nnbd_migration/src/edge_builder.dart:1258:9)
  #12     GeneralizingAstVisitor.visitFormalParameter (package:analyzer/dart/ast/visitor.dart:306:51)
  #13     GeneralizingAstVisitor.visitNormalFormalParameter (package:analyzer/dart/ast/visitor.dart:450:7)
  #14     GeneralizingAstVisitor.visitSimpleFormalParameter (package:analyzer/dart/ast/visitor.dart:502:7)
  #15     SimpleFormalParameterImpl.accept (package:analyzer/src/dart/ast/ast.dart:8793:15)
  #16     EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2104:22)
  #17     EdgeBuilder.visitDefaultFormalParameter (package:nnbd_migration/src/edge_builder.dart:719:5)
  #18     DefaultFormalParameterImpl.accept (package:analyzer/src/dart/ast/ast.dart:2987:15)
  #19     EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2104:22)
  #20     EdgeBuilder.visitNode (package:nnbd_migration/src/edge_builder.dart:1258:9)
  #21     GeneralizingAstVisitor.visitFormalParameterList (package:analyzer/dart/ast/visitor.dart:309:59)
  #22     FormalParameterListImpl.accept (package:analyzer/src/dart/ast/ast.dart:4449:49)
  #23     EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2104:22)
  #24     EdgeBuilder.visitFunctionExpression (package:nnbd_migration/src/edge_builder.dart:865:5)
  #25     FunctionExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:4963:49)
  #26     EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2104:22)
  #27     EdgeBuilder._handleAssignment (package:nnbd_migration/src/edge_builder.dart:2218:20)
  #28     EdgeBuilder.visitVariableDeclarationList (package:nnbd_migration/src/edge_builder.dart:1834:11)
  #29     VariableDeclarationListImpl.accept (package:analyzer/src/dart/ast/ast.dart:10575:15)
  #30     EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2104:22)
  #31     EdgeBuilder.visitNode (package:nnbd_migration/src/edge_builder.dart:1258:9)
  #32     GeneralizingAstVisitor.visitAnnotatedNode (package:analyzer/dart/ast/visitor.dart:137:47)
  #33     GeneralizingAstVisitor.visitDeclaration (package:analyzer/dart/ast/visitor.dart:230:43)
  #34     GeneralizingAstVisitor.visitCompilationUnitMember (package:analyzer/dart/ast/visitor.dart:205:7)
  #35     GeneralizingAstVisitor.visitTopLevelVariableDeclaration (package:analyzer/dart/ast/visitor.dart:554:7)
  #36     TopLevelVariableDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:9840:15)
  #37     EdgeBuilder._dispatch (package:nnbd_migration/src/edge_builder.dart:2104:22)
  #38     EdgeBuilder.visitNode (package:nnbd_migration/src/edge_builder.dart:1258:9)
  #39     GeneralizingAstVisitor.visitCompilationUnit (package:analyzer/dart/ast/visitor.dart:202:51)
  #40     CompletenessTracker.visitCompilationUnit.&lt;anonymous closure&gt; (package:nnbd_migration/src/utilities/completeness_tracker.dart:52:24)
  #41     PermissiveModeVisitor.reportExceptionsIfPermissive (package:nnbd_migration/src/utilities/permissive_mode.dart:26:24)
  #42     CompletenessTracker.visitCompilationUnit (package:nnbd_migration/src/utilities/completeness_tracker.dart:43:5)
  #43     CompilationUnitImpl.accept (package:analyzer/src/dart/ast/ast.dart:2119:49)
  #44     NullabilityMigrationImpl.processInput (package:nnbd_migration/src/nullability_migration_impl.dart:190:12)
  #45     NonNullableFix.processUnit (package:nnbd_migration/src/front_end/non_nullable_fix.dart:159:15)
  #46     _FixCodeProcessor.runLaterPhases.&lt;anonymous closure&gt; (package:nnbd_migration/migration_cli.dart:1023:19)
  #47     _FixCodeProcessor.processResources (package:nnbd_migration/migration_cli.dart:967:30)
  &lt;asynchronous suspension&gt;
  #48     _FixCodeProcessor.runLaterPhases (package:nnbd_migration/migration_cli.dart:1021:11)
  #49     MigrationCliRunner.run (package:nnbd_migration/migration_cli.dart:610:43)
  &lt;asynchronous suspension&gt;
  #50     MigrateCommand.run (package:nnbd_migration/migration_cli.dart:204:72)
  #51     CommandRunner.runCommand (package:args/command_runner.dart:197:27)
  #52     DartdevRunner.runCommand (package:dartdev/dartdev.dart:324:24)
  #53     CommandRunner.run.&lt;anonymous closure&gt; (package:args/command_runner.dart:112:25)
  #54     new Future.sync (dart:async/future.dart:223:31)
  #55     CommandRunner.run (package:args/command_runner.dart:112:14)
  #56     runDartdev (package:dartdev/dartdev.dart:143:27)
  #57     main (file:///b/s/w/ir/cache/builder/sdk/pkg/dartdev/bin/dartdev.dart:11:9)
  #58     _startIsolate.&lt;anonymous closure&gt; (dart:isolate-patch/isolate_patch.dart:297:32)
  #59     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)
  </code></pre>
  <p>How can I get <code>dart migrate</code> to work even though I'm using code gen?</p>