zino-hofmann / graphql-flutter

A GraphQL client for Flutter, bringing all the features from a modern GraphQL client to one easy to use package.
https://zino-hofmann.github.io/graphql-flutter
MIT License
3.24k stars 612 forks source link

Adding http logger to the requests #719

Closed MinaSamirCap closed 4 years ago

MinaSamirCap commented 4 years ago

I tried to add http_logger package to my project and it asked to add http_middleware package. https://pub.dev/packages/http_logger https://pub.dev/packages/http_middleware I got this error

Because graphql 3.1.0 depends on http ^0.12.0+4 and no versions of graphql match >3.1.0 <4.0.0, graphql ^3.1.0 requires http ^0.12.0+4. And because http_middleware >=1.0.0 depends on http ^0.11.3+16, http_middleware >=1.0.0 is incompatible with graphql ^3.1.0. And because graphql_flutter 3.1.0 depends on graphql ^3.1.0 and no versions of graphql_flutter match >3.1.0 <4.0.0, http_middleware >=1.0.0 is incompatible with graphql_flutter ^3.1.0. So, because mmd_ecommerce_fl_lib depends on both graphql_flutter ^3.1.0 and http_middleware ^1.0.0, version solving failed. pub get failed (1; So, because mmd_ecommerce_fl_lib depends on both graphql_flutter ^3.1.0 and http_middleware ^1.0.0, version solving failed.)

I need a way to use the http_logger or if the library uses another way to log request kindly let me know

vasilich6107 commented 4 years ago

Use dependency overrides https://dart.dev/tools/pub/dependencies#dependency-overrides

MinaSamirCap commented 4 years ago

I had already tried that but it fails because the flutter pub get can not find a convenient version between the graphql_flutter and http_middleware packages.

the first one requires http ^0.12.0+4 second one requires http ^0.11.3+16

if you try to use dependency_overrides like this dependency_overrides: http: ^0.11.3+16 or this dependency_overrides: http: ^0.12.0+4

you will get the following error in both cases no versions of graphql match >3.1.0 <4.0.0, graphql ^3.1.0 requires http ^0.12.0+4. because http_middleware >=1.0.0 depends on http ^0.11.3+16 and finally version solving failed.

this is my pubspec.yaml --> if you want to have a look on it and all repo https://github.com/BeshoyMelika/mmd-ecommerce-fl-lib/blob/master/pubspec.yaml

vasilich6107 commented 4 years ago

Here is your fix

example/pubspec - https://tppr.me/9NjqD pubspec - https://tppr.me/2bpVT

MinaSamirCap commented 4 years ago

I really appreciate your effort with me -- but still not working .. kindly check the screenshot you will find all dependency together and the error with them. dependency override

vasilich6107 commented 4 years ago

There are two pubspec files required to be modified. in project root and in example root

MinaSamirCap commented 4 years ago

Really I am grateful for your help --> thank you very much I did not notice that I must update both files of pubspec.yaml. it is new info for me. so, thanks and thanks and thanks

Unfortunately, the http_logger will not fit with my project so I decided to make the logger by my self, and I used this library as a reference https://github.com/azamat-murzagalin/http_ui_logger

Again and again, thank you very much.