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.25k stars 621 forks source link

feat: Add hooks examples #1034

Closed budde377 closed 2 years ago

budde377 commented 2 years ago

This PR rewrites the widgets to use hooks from flutter_hooks. These are subsequently exposed. This is a larger refactor which depends on #1037 to perform equality check of options.

While the widgets should be backwards compatible, our users will now be able to query with the syntax


final fetchResult = useQuery(QueryOptions(
  document: gql(" query { person } ")
));
codecov[bot] commented 2 years ago

Codecov Report

Merging #1034 (5b77b90) into beta (994e594) will increase coverage by 1.26%. The diff coverage is 38.46%.

:exclamation: Current head 5b77b90 differs from pull request most recent head b15a7d6. Consider uploading reports for the commit b15a7d6 to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##             beta    #1034      +/-   ##
==========================================
+ Coverage   52.67%   53.93%   +1.26%     
==========================================
  Files          35       40       +5     
  Lines        1513     1511       -2     
==========================================
+ Hits          797      815      +18     
+ Misses        716      696      -20     
Impacted Files Coverage Δ
...raphql_flutter/lib/src/widgets/hooks/mutation.dart 0.00% <0.00%> (ø)
...ql_flutter/lib/src/widgets/hooks/subscription.dart 0.00% <0.00%> (ø)
...ages/graphql_flutter/lib/src/widgets/mutation.dart 0.00% <0.00%> (ø)
.../graphql_flutter/lib/src/widgets/subscription.dart 0.00% <0.00%> (ø)
...hql_flutter/lib/src/widgets/hooks/watch_query.dart 78.37% <78.37%> (ø)
..._flutter/lib/src/widgets/hooks/graphql_client.dart 100.00% <100.00%> (ø)
...s/graphql_flutter/lib/src/widgets/hooks/query.dart 100.00% <100.00%> (ø)
...ackages/graphql_flutter/lib/src/widgets/query.dart 100.00% <100.00%> (+5.40%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2437565...b15a7d6. Read the comment docs.