Closed leonvisscher closed 2 years ago
This is fixed by this PR https://github.com/zino-hofmann/graphql-flutter/pull/1197
to solve this you should fix your dependencies of the link package to a major version, or maybe we should release a new beta version with this change included!
cc @budde377
Could you share your dependencies? This should not happen unless you use dependency overrides to gql_link 0.5.0
This happens if you clone a new project today I think, by the following rules gql_link: ^0.4.2
This is one of the reasons that I try to be reluctant to introduce breaking change often! We like to hack around and it is fine but a common user do this gql_link: 0.4.2
.
There problem is gone, and also the user!
@knaeckeKami
My pubspec.yaml looks like this:
name: flutter_complete_guide
description: A new Flutter project.
publish_to: 'none'
version: 1.0.0+1
environment:
sdk: ">=2.12.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
graphql_flutter: ^5.0.0
google_sign_in: ^5.4.1
sign_in_with_apple: ^4.1.0
flutter_signin_button: ^2.0.0
flutter_hooks: ^0.18.5+1
flutter_secure_storage: ^6.0.0
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true
assets:
- assets/
The app runs fine with the provided pubspec.yaml and main.dart for me. Could you try
flutter pub cache repair
so you ensure your pub cache is not corrupted . (the cthrow
syntax error suggests to me that something happened to the files)@knaeckeKami
Running flutter pub cache repair
fixed the problem, thanks! 😄
I already tried flutter clean
, pod deintegrate && pod install
, ... commands and building a new project and only copying the lib/** files but that didn't work. Why does flutter pub cache repair
do the job?
The easy solution is to share the version that you have of gql_link, if it is == 5.0.0, you need to override the dependence with : 0.4.2
and all will work fine
@leonvisscher : to me, it looks like you accidentally edited the file from gql_http_link manually after it it was downloaded by pub.dev, introducing a syntax error. Can happen if you inspected the source code from the imported package and the IDE is not configured to prevent you from editing files which don't belong to the project. Another explanation would be file system corruption (unlikely though as this usually changes characters, it does not add or remove them).
@vincenzopalazzo: Unless something goes horribly wrong, pub should never choose gql_link
0.5.0 (with the breaking change) when using the graphql
package.
Since graphql
depends on gql_link
^0.4.2, 0.5.0 is considered an incompatible version.
Trying to depend on it manually confirms that:
Because no versions of graphql_flutter match >5.1.0 <5.1.1-beta.1 and graphql_flutter >=5.0.2-beta.6 <5.1.0 depends on graphql ^5.0.2-beta.6, graphql_flutter >=5.0.2-beta.6 <5.1.0-∞ or >5.1.0 <5.1.1-beta.1 requires graphql ^5.0.2-beta.6.
And because graphql_flutter >=5.1.1-beta.1 <5.1.1-beta.2 depends on graphql ^5.1.1-beta.1, graphql_flutter >=5.0.2-beta.6 <5.1.0-∞ or >5.1.0 <5.1.1-beta.2 requires graphql ^5.0.2-beta.6.
And because graphql_flutter >=5.1.1-beta.2 depends on graphql ^5.1.2-beta.1 and graphql_flutter >=5.0.0-nullsafety.5 <5.0.1-beta.2 depends on gql_exec ^0.3.0, graphql_flutter >=5.0.0-nullsafety.5 <5.0.1-beta.2 or >=5.0.2-beta.6 <5.1.0-∞ or >5.1.0 requires gql_exec ^0.3.0 or graphql ^5.0.2-beta.6.
And because graphql_flutter >=5.0.1-beta.2 <5.0.2-beta.6 depends on gql_exec 0.3.0 and gql_link >=0.5.0 <0.5.1-alpha+1659917084473 depends on gql_exec ^0.4.0, if gql_link >=0.5.0 <0.5.1-alpha+1659917084473 and graphql_flutter >=5.0.0-nullsafety.5 <5.1.0-∞ or >5.1.0 then graphql ^5.0.2-beta.6.
And because graphql_flutter 5.1.0 depends on graphql ^5.1.0 which depends on gql_link ^0.4.2, gql_link >=0.5.0 <0.5.1-alpha+1659917084473 is incompatible with graphql_flutter >=5.0.0-nullsafety.5.
So, because flutter_complete_guide depends on both graphql_flutter ^5.0.0 and gql_link 0.5.0, version solving failed.
pub get failed (1; So, because flutter_complete_guide depends on both graphql_flutter ^5.0.0 and gql_link 0.5.0, version solving failed.)
I agree that we should be careful with breaking changes, but I think in this instance users should not be affected by that unless they use dependency overrides.
@vincenzopalazzo: Unless something goes horribly wrong, pub.dev should never choose gql_link 0.5.0 (with the breaking change) when using the graphql package.
Ah, ah you have right :D
Describe the issue When importing the plugin into my flutter main file, building the project throws the following error:
To Reproduce (MUST BE PROVIDED)
import 'package:graphql_flutter/graphql_flutter.dart';
at the top of my simple main.dart file this error is thrown:void main() async { runApp(MyApp()); }
class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'Bird App', home: Container( child: Text('Hello World'), ), theme: ThemeData( appBarTheme: AppBarTheme( backgroundColor: Colors.blue, ), ), ); } }