DEV Community

rrtutors
rrtutors

Posted on • Originally published at rrtutors.com

GraphQL Integration in Flutter

What is GraphQL and how to integrate GraphQL Api integration in flutter application.

What is GraphQL?

GraphQL is an open source technology which will be used at server side to create optimized APIs to replace REST apis. This GraphQL is developed by Facebook.

REST API contains multiple end points, where as GraphQL is single end point and Rest API will have the over fetching response which some of the response data not be used inside application, where as with GraphQL will fetch only required response.

When we are having more end points to work REST API might be difficulty to work, in that case GraphQL APIs will be more easy to implement. We can't decide which APIs we need to implements.

But in this example we are learning how to implement GraphQL APIs in flutter application

IMAGE ALT TEXT HERE

GraphQL mainly two types of operations will be there

Query
Mutation
Enter fullscreen mode Exit fullscreen mode

Query: This GraphQL operation will be used to Read/Fetch data from the End point

Syntax:

query query_name{ Fields }

Enter fullscreen mode Exit fullscreen mode

Mutation: This GraphQL operation will be used to write/post data to the End point.

mutation{
   editOperation(dataField:"valueOfField"):returnType
}
Enter fullscreen mode Exit fullscreen mode

Discussion (0)