dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.25k stars 1.58k forks source link

dart migrate: [Error] isDartAsyncFuture was called on null #45753

Closed gabeaventh closed 11 months ago

gabeaventh commented 3 years ago

This tracker is for issues related to:

If you aren't sure, file the issue here and we'll find the right home for it. In your issue, please include:

i am having trouble to migrate my flutter app using dart migrate

short intro: so i was doing migration, the other local package that i put inside my project are migrated successfully using dart migrate

the only problem is the top level project, always showing isDartAsyncFuture was called on null

maybe someone can help me to successfully migrate the top level project

here's the error log, verbose only showing the time no additional error shown:

dart migrate
Migrating D:\dev\workspace\my_project

See https://dart.dev/go/null-safety-migration for a migration guide.

Note: more than one project found; migrating the top-level project.

Analyzing project...
NoSuchMethodError: The getter 'isDartAsyncFuture' was called on null.
Receiver: null
Tried calling: isDartAsyncFuture
#0      Object.noSuchMethod (dart:core-patch/object_patch.dart:54:5)
#1      CatchErrorVerifier.verifyMethodInvocation (package:analyzer/src/error/catch_error_verifier.dart:40:27)
#2      BestPracticesVerifier.visitMethodInvocation (package:analyzer/src/error/best_practices_verifier.dart:596:25)
#3      MethodInvocationImpl.accept (package:analyzer/src/dart/ast/ast.dart:7186:49)
#4      ExpressionStatementImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:3680:18)
#5      RecursiveAstVisitor.visitExpressionStatement (package:analyzer/dart/ast/visitor.dart:839:10)
#6      ExpressionStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:3676:49)
#7      NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7611:20)
#8      BlockImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1087:17)
#9      RecursiveAstVisitor.visitBlock (package:analyzer/dart/ast/visitor.dart:671:10)
#10     BlockImpl.accept (package:analyzer/src/dart/ast/ast.dart:1083:49)
#11     IfStatementImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:5710:21)
#12     RecursiveAstVisitor.visitIfStatement (package:analyzer/dart/ast/visitor.dart:977:10)
#13     IfStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:5705:49)
#14     NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7611:20)
#15     BlockImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1087:17)
#16     RecursiveAstVisitor.visitBlock (package:analyzer/dart/ast/visitor.dart:671:10)
#17     BlockImpl.accept (package:analyzer/src/dart/ast/ast.dart:1083:49)
#18     CatchClauseImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1397:12)
#19     RecursiveAstVisitor.visitCatchClause (package:analyzer/dart/ast/visitor.dart:701:10)
#20     BestPracticesVerifier.visitCatchClause (package:analyzer/src/error/best_practices_verifier.dart:299:11)
#21     CatchClauseImpl.accept (package:analyzer/src/dart/ast/ast.dart:1390:49)
#22     NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7611:20)
#23     TryStatementImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:10007:19)
#24     RecursiveAstVisitor.visitTryStatement (package:analyzer/dart/ast/visitor.dart:1278:10)
#25     TryStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:10002:49)
#26     NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7611:20)
#27     BlockImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1087:17)
#28     RecursiveAstVisitor.visitBlock (package:analyzer/dart/ast/visitor.dart:671:10)
#29     BlockImpl.accept (package:analyzer/src/dart/ast/ast.dart:1083:49)
#30     BlockFunctionBodyImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1042:13)
#31     RecursiveAstVisitor.visitBlockFunctionBody (package:analyzer/dart/ast/visitor.dart:677:10)
#32     BlockFunctionBodyImpl.accept (package:analyzer/src/dart/ast/ast.dart:1038:49)
#33     MethodDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:7042:12)
#34     RecursiveAstVisitor.visitMethodDeclaration (package:analyzer/dart/ast/visitor.dart:1067:10)
#35     BestPracticesVerifier.visitMethodDeclaration (package:analyzer/src/error/best_practices_verifier.dart:585:13)
#36     MethodDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:7033:49)
#37     NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7611:20)
#38     ClassDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1566:13)
#39     RecursiveAstVisitor.visitClassDeclaration (package:analyzer/dart/ast/visitor.dart:707:10)
#40     BestPracticesVerifier.visitClassDeclaration (package:analyzer/src/error/best_practices_verifier.dart:320:13)
#41     ClassDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:1536:49)
#42     NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7611:20)
#43     CompilationUnitImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:2141:21)
#44     RecursiveAstVisitor.visitCompilationUnit (package:analyzer/dart/ast/visitor.dart:731:10)
#45     CompilationUnitImpl.accept (package:analyzer/src/dart/ast/ast.dart:2134:49)
#46     LibraryAnalyzer._computeHints (package:analyzer/src/dart/analysis/library_analyzer.dart:281:10)
#47     LibraryAnalyzer.analyzeSync.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:167:9)
#48     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:397:8)
#49     LibraryAnalyzer.analyzeSync (package:analyzer/src/dart/analysis/library_analyzer.dart:166:13)
#50     LibraryAnalyzer.analyze (package:analyzer/src/dart/analysis/library_analyzer.dart:107:12)
#51     AnalysisDriver._computeResolvedLibrary2.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1416:65)
#52     PerformanceLog.run (package:analyzer/src/dart/analysis/performance_logger.dart:32:15)
#53     AnalysisDriver._computeResolvedLibrary2 (package:analyzer/src/dart/analysis/driver.dart:1402:20)
#54     AnalysisDriver._computeResolvedLibrary.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1395:15)
#55     _rootRun (dart:async/zone.dart:1354:13)
#56     _CustomZone.run (dart:async/zone.dart:1258:19)
#57     _runZoned (dart:async/zone.dart:1788:10)
#58     runZoned (dart:async/zone.dart:1710:10)
#59     NullSafetyUnderstandingFlag.enableNullSafetyTypes (package:analyzer/dart/element/null_safety_understanding_flag.dart:42:12)
#60     AnalysisDriver._computeResolvedLibrary (package:analyzer/src/dart/analysis/driver.dart:1394:40)
#61     AnalysisDriver.performWork (package:analyzer/src/dart/analysis/driver.dart:964:22)
#62     AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2018:24)
<asynchronous suspension>

dart analyze seems fine, showing how many issues i have at the end of the line 379 issues found.

pubspec.yaml

name: neu
description: A new Flutter project.
publish_to: none
version: 1.1.9+11900

environment:
  sdk: ">=2.10.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  logging: ^1.0.1
  flutter_bloc: ^7.0.0
  flutter_svg: ^0.21.0+1
  equatable: ^2.0.0
  shared_preferences: ^2.0.5
  dio: ^4.0.0
  graphql: ^5.0.0-nullsafety.4
  flutter_modular: ^3.1.0
  intl: ^0.17.0
  encrypt: ^5.0.0
  dartz: ^0.10.0-nullsafety.1
  firebase_crashlytics: ^2.0.0
  sensors: ^2.0.0
  flutter_localizations:
    sdk: flutter
  sqflite: ^2.0.0+3
  firebase_analytics: ^8.0.0
  dotted_border: ^2.0.0
  crypto: ^3.0.1
  device_info: ^2.0.0
  package_info: ^2.0.0
  share: ^2.0.1
  android_intent: ^2.0.0
  url_launcher: ^6.0.3
  html2md: ^1.0.1
  flutter_markdown: ^0.6.1
  store_redirect:
    path: ./plugin/store_redirect
  fluttertoast: ^8.0.4
  firebase_remote_config: ^0.10.0-dev.0
  firebase_core: ^1.0.3
  firebase_database: ^6.1.2
  flutter_ditto:
    path: ./plugin/flutter-ditto
  html: ^0.15.0
  flutter_html: ^2.0.0-nullsafety.0
  camera:
    path: ./plugin/camera
  path_provider: ^2.0.1
  screenshot: ^1.0.0-nullsafety.1
  contacts_service: ^0.6.0
  permission_handler: ^6.1.3
  flare_flutter: ^3.0.0
  image_picker: ^0.7.4
  cached_network_image: ^3.0.0
  substring_highlight:
    path: ./plugin/substring_highlight
  percent_indicator: ^3.0.1
  flutter_holo_date_picker: ^1.0.0-nullsafety.1
  shimmer:
    path: ./plugin/flutter_shimmer
  currency_text_input_formatter: ^2.0.1
  flutter_switch: ^0.3.1
  firebase_dynamic_links: ^2.0.0
  fl_chart: ^0.35.0
  youtube_player_flutter: ^8.0.0
  flutter_inappwebview: ^5.3.2
  datadog_flutter: ^1.0.0-nullsafety.0
  # this package to replace a package that written on local
  # that no longer working on Flutter 2.0
  # please update to ^3.0.0 when we Upgrade to v2.0
  # TODO: Remove this when the package updated the code
  extended_nested_scroll_view: ^3.0.0

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2

dev_dependencies:
  test: ^1.16.5
  pedantic: ^1.11.0
  effective_dart: ^1.3.1
  mockito: ^5.0.4
  flutter_test:
    sdk: flutter
  # will not be used until flutter_driver fully migrated to null-safety
  # flutter_driver:
  #   sdk: flutter

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:
  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true

  assets:
    # Vectors
    - assets/vectors/icons/
    - assets/vectors/illustrations/
    - assets/vectors/animations/

    # # Images
    - assets/images/
stereotype441 commented 11 months ago

As of 1c7fe7196dd7a542f7f91cd6ea2ac81e1a13146c, the null safety migration tool has been removed from active development and retired. No further work on the tool is planned.

If you still need help, or you believe this issue has been closed in error, please feel free to reopen.