我正在尝试将我的项目迁移到 null-safety,但在编译检测信息步骤后该过程立即崩溃。我不断收到的错误并没有真正的帮助,也没有指出问题发生的位置。
错误信息如下:
RangeError (index): Invalid value: Valid value range is empty: 0
#0 List.[] (dart:core-patch/growable_array.dart:254:60)
#1 CodeChecker._checkCompoundAssignment (package:analyzer/src/task/strong/checker.dart:565:60)
#2 CodeChecker.visitAssignmentExpression (package:analyzer/src/task/strong/checker.dart:194:7)
#3 AssignmentExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:711:15)
#4 ExpressionStatementImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:3602:17)
#5 RecursiveAstVisitor.visitExpressionStatement (package:analyzer/dart/ast/visitor.dart:843:10)
#6 ExpressionStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:3598:50)
#7 NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7517:20)
#8 BlockImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1069:17)
#9 RecursiveAstVisitor.visitBlock (package:analyzer/dart/ast/visitor.dart:675:10)
#10 BlockImpl.accept (package:analyzer/src/dart/ast/ast.dart:1065:50)
#11 WhileStatementImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:10630:11)
#12 CodeChecker.visitWhileStatement (package:analyzer/src/task/strong/checker.dart:532:10)
#13 WhileStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:10625:50)
#14 NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7517:20)
#15 BlockImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1069:17)
#16 RecursiveAstVisitor.visitBlock (package:analyzer/dart/ast/visitor.dart:675:10)
#17 BlockImpl.accept (package:analyzer/src/dart/ast/ast.dart:1065:50)
#18 BlockFunctionBodyImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1024:12)
#19 RecursiveAstVisitor.visitBlockFunctionBody (package:analyzer/dart/ast/visitor.dart:681:10)
#20 BlockFunctionBodyImpl.accept (package:analyzer/src/dart/ast/ast.dart:1020:50)
#21 MethodDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:6951:11)
#22 RecursiveAstVisitor.visitMethodDeclaration (package:analyzer/dart/ast/visitor.dart:1071:10)
#23 MethodDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:6942:50)
#24 NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7517:20)
#25 ClassDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1544:13)
#26 RecursiveAstVisitor.visitClassDeclaration (package:analyzer/dart/ast/visitor.dart:711:10)
#27 ClassDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:1514:50)
#28 NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7517:20)
#29 CompilationUnitImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:2112:21)
#30 CodeChecker.visitCompilationUnit (package:analyzer/src/task/strong/checker.dart:230:10)
#31 LibraryAnalyzer._computeVerifyErrors (package:analyzer/src/dart/analysis/library_analyzer.dart:384:13)
#32 LibraryAnalyzer.analyzeSync.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:141:7)
#33 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:397:8)
#34 LibraryAnalyzer.analyzeSync (package:analyzer/src/dart/analysis/library_analyzer.dart:140:11)
#35 LibraryAnalyzer.analyze (package:analyzer/src/dart/analysis/library_analyzer.dart:104:12)
#36 AnalysisDriver._computeResolvedLibrary.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1405:65)
#37 PerformanceLog.run (package:analyzer/src/dart/analysis/performance_logger.dart:32:15)
#38 AnalysisDriver._computeResolvedLibrary (package:analyzer/src/dart/analysis/driver.dart:1391:20)
#39 AnalysisDriver.performWork (package:analyzer/src/dart/analysis/driver.dart:970:22)
#40 AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2006:24)
<asynchronous suspension>
这是我的 Flutter 医生输出:
[✓] Flutter (Channel beta, 2.3.0-24.1.pre, on macOS 11.4 20F71 darwin-x64, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.2)
[✓] VS Code (version 1.56.2)
[✓] Connected device (2 available)
• No issues found!
有关如何解决问题的任何信息将不胜感激
答案 0 :(得分:0)
切换到稳定频道后问题解决了。但是,在撰写本文时,此问题可在所有其他颤振通道上重现。