Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in generating files build runner for version 4.0.0-nullsafety.0 #238

Closed
mammba01012018 opened this issue Mar 31, 2021 · 25 comments
Closed
Milestone

Comments

@mammba01012018
Copy link

Getting error with running "flutter pub run build_runner build --delete-conflicting-outputs".

Here's my definition in service

@post(path: "/api/updateMember")
Future<Response> updateMember(@Body() Member body);

and I'm getting this error

image

It used to work on previous build (version 3.0.6). Any idea on why this does not work now

@christosoikonomou
Copy link

Same issue for me

@deepak-ra
Copy link

Any Solution?

@lejard-h
Copy link
Owner

lejard-h commented Apr 3, 2021

Any chance someone provide enough code to repro ?

Also which version of flutter/dart sdk are you using ?

@deepak-ra
Copy link

@lejard-h
Dart SDK version: 2.12.2
Flutter 2.0.3

chopper: ^4.0.0-nullsafety.0
build_runner: ^1.12.2
chopper_generator: ^4.0.0-nullsafety.0

Code:
@Post(path: '/client/profile/add/address') Future<Response> addAddress(@Body() Map<String, dynamic> data);

Error:
line 75, column 61 of .: Expected to find ')'.
@override Future<Response<dynamic>> addAddress(Map<String*, dynamic>* data) { final $url = '/client/profile/add/address';

@deepak-kumar-swain
Copy link

Any Update on this By chance?
Not able to work further on my app, as this is the breaking/{something} stuff.

@BirjuVachhani
Copy link

Same here.

@saisasanksunkavalli
Copy link

Was facing the same issue here. Any update on this ?

Dependencies included

chopper_generator: ^4.0.0-nullsafety.0
chopper: ^4.0.0-nullsafety.0

@IanWorthington
Copy link

IanWorthington commented Apr 6, 2021

Same. 3.0.6 parses it ok.

[SEVERE] chopper_generator:chopper_generator on lib/YahooService.dart:

Could not format because the source could not be parsed:

line 10, column 51 of .: Expected to find ')'.
   ╷
10 │ @override Future<Response<dynamic>> getPost(String* id) { final $url = '/autoc?query=$id&region=EU&lang=en-GB';
   │                                                   ^
   ╵
line 13, column 49 of .: Expected to find ')'.
   ╷
13 │ @override Future<Response<dynamic>> postPost(Map<String*, dynamic>* body) { final $url = '';
   │                                                 ^
   ╵
[INFO] Running build completed, took 28.2s

@lejard-h
Copy link
Owner

lejard-h commented Apr 7, 2021

Sorry I still can't reproduce.

Maybe double check all your packages are up to date. Probably an issue with the analyzer.

@JEuler @stewemetal any ideas ?

@BirjuVachhani
Copy link

@lejard-h IF it comes to overriding analyzer dependency, which version should we use?

@lejard-h
Copy link
Owner

lejard-h commented Apr 8, 2021

do you infos when running dart pub outdated ?

I ran my tests with NO outdated dependencies (except graphs) with Flutter 2.0.3 and dart sdk 2.12.2

@deepak-kumar-swain
Copy link

Got the solution:

change sdk to sdk: ">=2.12.0 <3.0.0"
add chopper: ^4.0.0-nullsafety.0 in dependencies and
chopper_generator: ^4.0.0-nullsafety.0
build_runner: ^1.5.0 in dev_dependencies

@BirjuVachhani
Copy link

@lejard-h
This is what I'm getting when running pub outdated command.

As my project is not migrated to null-safety completely as 2-3 dependencies are yet to be migrated and then I'd have to migrate my project, I am still using Dart >=2.7.0 constraint.

Showing outdated packages.
[*] indicates versions that are not the latest available.

Package Name    Current  Upgradable  Resolvable  Latest   

direct dependencies: all up-to-date.

dev_dependencies: all up-to-date.

transitive dependencies:
enum_to_string  *1.0.14  *1.0.14     *1.0.14     2.0.1    
source_span     *1.8.0   *1.8.0      *1.8.0      1.8.1    
test_api        *0.2.19  *0.2.19     *0.2.19     0.3.0    
wakelock        *0.4.0   *0.4.0      *0.4.0      0.5.0+2  

transitive dev_dependencies:
graphs          *1.0.0   *1.0.0      *1.0.0      2.0.0    
You are already using the newest resolvable versions listed in the 'Resolvable' column.
Newer versions, listed in 'Latest', may not be mutually compatible.

@bbader000
Copy link

same issue for me

@lejard-h lejard-h added this to the 4.0.0 stable milestone Apr 10, 2021
@JEuler
Copy link
Collaborator

JEuler commented Apr 16, 2021

Sorry, was out on vacation. I'm getting this error on my paused work project. So, I will investigate it and try to solve it on weekend. 👍

@JEuler
Copy link
Collaborator

JEuler commented Apr 16, 2021

Oh, lol. I forgot to change environment to this:
sdk: ">=2.12.0 <3.0.0"
Now it is working :)

@bbader000 @BirjuVachhani @IanWorthington @saisasanksunkavalli @deepak-ra @mammba01012018 @christosoikonomou

@JEuler
Copy link
Collaborator

JEuler commented Apr 19, 2021

Guys? :) Do you have it working? :)

@BirjuVachhani
Copy link

@JEuler Not yet. The targeting dart SDK to 2.12.0 works but I cannot use it right now as all the dependencies are not migrated to null safety and I can't migrate my project completely.

@JEuler
Copy link
Collaborator

JEuler commented Apr 20, 2021

But this is not related to the chopper, I believe )

@BirjuVachhani
Copy link

@JEuler chopper generator is not able to generate code in this case. It fails with exit code 1.

@JEuler
Copy link
Collaborator

JEuler commented Apr 20, 2021 via email

@BirjuVachhani
Copy link

@JEuler Yes, I agree. When I tried this, I satisfied the dependency graph for the project and there were no dependency overrides. The only thing remaining was to target SDK 2.12.0 and migrate my own source code. Now I think I will have to wait until all the dependencies are null-safe and then start migrating.

@JEuler
Copy link
Collaborator

JEuler commented Apr 20, 2021

Okay, I will close that issue. Everyone, feel free to reopen it, but:

it is a null-safety version of chopper_generator. So, it depends on the
null-safety version of build_runner and other libs and the 2.12.0 SDK is
needed.

@JEuler JEuler closed this as completed Apr 20, 2021
@BirjuVachhani
Copy link

BirjuVachhani commented Apr 20, 2021

@JEuler build_runner doesn't have a null safe version. Besides pub upgrade and pug get commands execute successfully without any errors so all the dependencies must be satisfied. I feel like this is not causing issue but it must be something else. Maybe it is because of SDK 2.12.0 and some internal dart code

@JEuler
Copy link
Collaborator

JEuler commented Apr 20, 2021

I haven't checked the build_runner version, so, I'm wrong, but I mean that this is version with fresh dependencies and it depends on 2.12.0 SDK, so, generator is working with fresh SDK :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants