22
[INFO] Precompiling build script......
[WARNING] ../../flutter/.pub-cache/hosted/pub.dartlang.org/gql_code_builder-0.2.0/lib/src/ast.dart:618:12: Error: A non-null value must be returned since the return type 'Expression' doesn't allow null.
 - 'Expression' is from 'package:code_builder/src/specs/expression.dart' ('../../flutter/.pub-cache/hosted/pub.dartlang.org/code_builder-4.1.0/lib/src/specs/expression.dart').
Expression _directiveLocation(DirectiveLocation location) {
           ^
[INFO] Precompiling build script... completed, took 838ms

[SEVERE] Failed to precompile build script .dart_tool/build/entrypoint/build.dart.
This is likely caused by a misconfigured builder definition.
2
  • post your pubspec.yaml and flutter -doctor output Commented Apr 22, 2022 at 4:24
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Apr 22, 2022 at 12:20

4 Answers 4

26

flutter pub upgrade && flutter clean && flutter pub cache clean

this helped me

Sign up to request clarification or add additional context in comments.

3 Comments

Adding flutter pub get, resolved it for me
It is flutter pub cache clean - NOT clear
this solution not working for all cases it's for specific one with specific packages
12

Try "flutter pub upgrade". This helped me.

Comments

7

Deleting the pubspec.lock file fixed it for me.

In my case, this seems to have been caused by running flutter pub get with circular dependancies.

2 Comments

This worked for me, thanks a lot
This also worked for me when changing environment from windows to macos
1

It looks like here there is a fix gql-dart/gql#308

dependency_overrides:
  gql: 0.13.0

1 Comment

This work only for gql package. In other cases it's useless.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.