comigor / artemis

Build dart types from GraphQL schemas and queries
MIT License
495 stars 119 forks source link

Comparison with graphql_flutter/graphql package #335

Closed manlyman29 closed 3 years ago

manlyman29 commented 3 years ago

Hello, I have been worked with both of these gql clients for a while now beside each other. I have some doubts about how this two should be used and for flutter newbies like me i think others could be confused at first as well, There are guides on internet on using both at the same time but it doesn't feels completely natural to me. Most important differences i could see was graphql_flutter supports cache and Artemis does code generation, right? Are they supposed to be used beside each other? Any best practices or suggestion to use only one maybe?

vasilich6107 commented 3 years ago

@ridyio

Did you get along with this article? https://medium.com/@v.ditsyak/ultimate-toolchain-to-work-with-graphql-in-flutter-13aef79c6484

vasilich6107 commented 3 years ago

To be short - graphql_flutter is a client Artemis for code generation

manlyman29 commented 3 years ago

Thanks for response, yes i have read that article. The part that made me doubt if these two are meant to be used along each other was when calling a mutation:

Mutation(
    options: MutationOptions(
        document: CreateAddressMutation(
                variables: CreateAddressArguments(
                    title: "",
                    details: "",
                    lat: 10.1,
                    lng: 10.1))
            .document),
    builder: (
      RunMutation runMutation,
      QueryResult? result,
    ) {
      return ElevatedButton(
          onPressed: () {
            if (_formKey.currentState!.validate()) {
              runMutation({
                "title": "T",
                "details": "D",
                "lat": 10.1,
                "lng": 10.1
              });
            }
          },
          child: Text('Save'),
          ));

I couldn't find a way around having to pass the arguments twice maybe i did something wrong here.

vasilich6107 commented 3 years ago

@ridyio check this https://github.com/comigor/artemis/issues/314

manlyman29 commented 3 years ago

@vasilich6107 Thanks a lot, Got it now