I started my project when null safety wasn't stable and I did not want to use it back then. Now I'm heading to deployment and I want to upgrade the project to use Null-Safety. I keep getting this error, tried it on both stable and dev channel and Flutter & Dart are both up to date.

Analyzing project...
[-----------------------------------------------------------------------------|]No analysis issues found.

Generating migration suggestions...
[------------------------------------------------------------------------------]

Compiling instrumentation information...
[-----------------------------------                                           ]RangeError (index): Invalid value: Not in inclusive range 0..12: 13
#0      List.[] (dart:core-patch/array.dart:268:52)
#1      BestPracticesVerifier._targetKindsFor (package:analyzer/src/error/best_practices_verifier.dart:1582:38)
#2      BestPracticesVerifier.visitAnnotation (package:analyzer/src/error/best_practices_verifier.dart:250:17)
#3      AnnotationImpl.accept (package:analyzer/src/dart/ast/ast.dart:280:49)
#4      NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7611:20)
#5      AnnotatedNodeImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:148:17)
#6      ClassDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1559:11)
#7      RecursiveAstVisitor.visitClassDeclaration (package:analyzer/dart/ast/visitor.dart:707:10)
#8      BestPracticesVerifier.visitClassDeclaration (package:analyzer/src/error/best_practices_verifier.dart:320:13)
#9      ClassDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:1536:49)
#10     NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7611:20)
#11     CompilationUnitImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:2141:21)
#12     RecursiveAstVisitor.visitCompilationUnit (package:analyzer/dart/ast/visitor.dart:731:10)
#13     CompilationUnitImpl.accept (package:analyzer/src/dart/ast/ast.dart:2134:49)
#14     LibraryAnalyzer._computeHints (package:analyzer/src/dart/analysis/library_analyzer.dart:281:10)
#15     LibraryAnalyzer.analyzeSync.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:167:9)
#16     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:397:8)
#17     LibraryAnalyzer.analyzeSync (package:analyzer/src/dart/analysis/library_analyzer.dart:166:13)
#18     LibraryAnalyzer.analyze (package:analyzer/src/dart/analysis/library_analyzer.dart:107:12)
#19     AnalysisDriver._computeResolvedLibrary2.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1416:65)
#20     PerformanceLog.run (package:analyzer/src/dart/analysis/performance_logger.dart:32:15)
#21     AnalysisDriver._computeResolvedLibrary2 (package:analyzer/src/dart/analysis/driver.dart:1402:20)
#22     AnalysisDriver._computeResolvedLibrary.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1395:15)
#23     _rootRun (dart:async/zone.dart:1354:13)
#24     _CustomZone.run (dart:async/zone.dart:1258:19)
#25     _runZoned (dart:async/zone.dart:1788:10)
#26     runZoned (dart:async/zone.dart:1710:10)
#27     NullSafetyUnderstandingFlag.enableNullSafetyTypes (package:analyzer/dart/element/null_safety_understanding_flag.dart:42:12)
#28     AnalysisDriver._computeResolvedLibrary (package:analyzer/src/dart/analysis/driver.dart:1394:40)
#29     AnalysisDriver.performWork (package:analyzer/src/dart/analysis/driver.dart:964:22)
#30     AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2018:24)
<asynchronous suspension>


Solution 1: sajjad hajizadeh

You have in a list that has 12 items, you work with item number 13 that you get this error