dart-graphql / graphql_client Goto Github PK
View Code? Open in Web Editor NEWGraphQL Client.
Home Page: https://pub.dartlang.org/packages/graphql_client
License: MIT License
GraphQL Client.
Home Page: https://pub.dartlang.org/packages/graphql_client
License: MIT License
I'm currently trying to run a mutation, which doesn't return locations
, if there was an error.
Unfortunately, it seems like locations
is required in case there was an error.
NoSuchMethodError: The method 'map' was called on null.
Receiver: null
Tried calling: map(Closure: (dynamic) => Location)
#0 Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:46:5)
#1 new GQLError.fromJSON (package:graphql_client/src/exceptions.dart:39:33)
#2 new GQLException.<anonymous closure> (package:graphql_client/src/exceptions.dart:61:44)
#3 MappedListIterable.elementAt (dart:_internal/iterable.dart:414:29)
#4 ListIterator.moveNext (dart:_internal/iterable.dart:343:26)
#5 new List.from (dart:core/runtime/libarray_patch.dart:51:29)
#6 new GQLException (package:graphql_client/src/exceptions.dart:61:7)
#7 GQLClient._parseResponse (package:graphql_client/src/client.dart:109:17)
#8 GQLClient.execute (package:graphql_client/src/client.dart:65:20)
Query:
mutation($username: String!, $password: String!) {
createToken (username: $username, password: $password) {
token
}
}
Response:
{
"data": {
"createToken": null
},
"errors": [
{
"message": "Username and password required.",
"path": [
"createToken"
]
}
]
}
Successfull request work as expected.
I've tried to modify exceptions.dart
, but without luck. (Just started with Dart a few days ago.)
I am new to Dart... any hints on why? thx. Billy.
On this line: The IDE gives me a warning of Invalid Override.
OperationType get type => OperationType.query;
At runtime:
malformed type: line 93 pos 3: cannot resolve class 'OperationType' from 'ViewerBioQuery' OperationType get type => OperationType.query; ^
Hi, I contacted you via email. I'd love to continue this work, and include support for https://github.com/jaydenseric/graphql-upload as well
As I know dart team will deprecate transformer API favor to builder api. Like https://github.com/google/built_value.dart I think it would be great if it ll be builder from the beginning
Could you make an example where you don't use an endpoint url ?
The reason is because I have to write plugins in golang and wrap in Java and swift. Graphql is a really nice way to avoid having to write a ton of java and swift code on a large API.
So from flutter I just call a single method and it passes through to the golang layer which then sees the query and does it's thing and returns the graphql response
It's not the fastest but it's convenient.
It's also kind of nice because I can use the same technique for making server caller from flutter also, which is when of course I do need an endpoint
Inside the plugin I use golang which has pretty good graphql support including resolvers.
If you want more info just ask.
If your super busy just say and I can try to do it myself and publish and example.
I'm more than willing to submit a PR for this, and to help with the development of this package.
I've written a GraphQL parser and GraphQL type implementation package for Dart, and am trying to get some server-side and cross-platform implementations going:
So I anticipate myself using the client a lot.
That being said, dart:mirrors
can potentially cause a code size bloat via dart2js, and is entirely unsupported by Flutter. A potential solution might be some sort of code generation?
when value of resolved field is List type, met error:
E/flutter (28080): type 'List<dynamic>' is not a subtype of type 'Map<dynamic, dynamic>'
E/flutter (28080): #0 GQLClient._resolve (package:graphql_client/src/client.dart:168:31)
E/flutter (28080): #1 GQLClient._resolveFields (package:graphql_client/src/client.dart:122:9)
E/flutter (28080): #2 GQLClient._resolveQuery (package:graphql_client/src/client.dart:115:5)
E/flutter (28080): #3 GQLClient.execute (package:graphql_client/src/client.dart:70:7)
...
my GraphQL query is:
query ActivitiesQuery {
activities {
id
}
}
and the http response body is:
{
"data": {
"activities": [
{
"id": "cjjb31t5rdjp701200999b2r1"
}
]
}
}
I noticed there is the ScalarCollection
abstract class(mixin) and maybe it was designed for GraphQL pagination purpose.
Am I missing something how to handle value of List type field that is not follow GraphQL pagination format ? thx a lot.
Visiting https://pub.dartlang.org/packages/graphql_client at the bottom there is a link to the ROADMAP.md file which is gone?
Hey! Thanks for creating that lib. I'm going to look into at once I'm more familiar with the basics of dart again. It's been a long time...
I want to learn about your approach to create the queries like this:
https://github.com/hourliert/graphql_client/blob/716ddcae1b33a7400c99dd89fc96a0a6b0a948a6/example/graphql_client_example.dart#L27-L39
IMO it's way better to use simple string queries, run them and after getting the response marshall them into the objects you'd like to work with.
What makes this so much better to work with, is the fact that you can actually write the queries in GraphiQL and just copy & paste them over into your code. This is just not possible with the current approach and thus probably error prone.
Cheers ๐ป
https://github.com/dart-lang/mono_repo/tree/master/mono_repo
Make it easier to set up travis, etc
Nice library btw!
This issue will be used to test mutations.
GraphQL doesn't have to be served over http. In Apollo, they have abstracted the network client away, while providing a default implementation. This is great for things like testing, support for subscriptions over websockets, or any other customization the user wants to make without having to support it in this library.
I would like this abstraction so that I could build a graphql server in dart to act as a proxy to the real graphql server. I would store all mutations while off network and handle them in dart, then next time the network is back online, I would send all of them to the real server.
I don't think this library should be responsible for this kind of functionality, so I think the network abstraction would be the best option.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.