Series 7 — Part 1 of 1
GraphQL in Flutter: Queries, Mutations, and Why It Changes How You Think About APIs
A standalone post on integrating GraphQL using the graphql_flutter package
Every API I had worked with in Flutter so far used REST — a fixed set of endpoints that return fixed data shapes. GraphQL is different. Instead of the server deciding what data you get, the client specifies exactly what it needs. I spent a day reading about GraphQL concepts and another day implementing a Flutter app that used it.
The GraphQL mental model
In REST you call GET /products and get everything the server thinks you need. In GraphQL you write a query that specifies exactly which fields you want:
query GetProducts { products { id name price } }
Enter fullscreen mode
Exit fullscreen mode
The server returns exactly that — no more, no less.…