Flutter Apprentice: Using Chopper chapter

When running flutter pub run build_runner build --delete-conflicting-outputs --verbose

I see below error

dev_dependencies:
analyzer: ^6.3.0

[SEVERE] json_serializable on lib/network/recipe_model.dart:

Null check operator used on a null value
#0 ElementAnnotationExtensions.targetKinds (package:analyzer/src/dart/element/extensions.dart:42:51)
#1 BestPracticesVerifier.visitAnnotation (package:analyzer/src/error/best_practices_verifier.dart:323:25)
#2 AnnotationImpl.accept (package:analyzer/src/dart/ast/ast.dart:318:50)
#3 NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:8777:20)
#4 AnnotatedNodeImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:154:17)
#5 ClassDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1823:11)
#6 RecursiveAstVisitor.visitClassDeclaration (package:analyzer/dart/ast/visitor.dart:793:10)

Post that it’s stuck in a loop trying to generate the chopper file. Need help to unblock this step

Flutter 3.16.0 β€’ channel stable β€’ GitHub - flutter/flutter: Flutter makes it easy and fast to build beautiful apps for mobile and beyond
Framework β€’ revision db7ef5bf9f (8 days ago) β€’ 2023-11-15 11:25:44 -0800
Engine β€’ revision 74d16627b9
Tools β€’ Dart 3.2.0 β€’ DevTools 2.28.2

Hi @csanthosh13

thanks for reporting this.
We are updating the book to make it compatible with Flutter 3.16.0 (that you are using).
The easiest way to unlock this situation at the moment is to use Flutter 3.3.

1 Like