GraphQL Users & Posts
π· Illustrative gifs of the project:
π· Illustrative image of the Figma:
π‘ Idea:
Create a Flutter Project in order to connect to a GraphQL Server (https://github.com/AmandaCleto/vanilla--graphql-crud-users-and-posts-api--back/). For that, I'll be using graphql_flutter
as dependence.
The project is a simple crud of posts and users, where you can create/read/delete posts from an user and create/read/update/delete users;
note: when deleting an user all its posts will be deleted as well.
π Apprenticeship:
This project was meant to be a learning project in how to use GraphQL in Flutter, for that, I first create a GraphQL server by following the tutorial from Mateus Silva, then I proceed by creating a simple landing page layout in Figma web design app, so I could use as prototype to my Flutter app.
By using graphql_flutter
as dependence, I could fetch only the necessary responses my pages would display, and also could refetch only when needed.
graphql_flutter
is an easy-to-use library that is filled with lots of functionalities, yet, in this project I focus in how to use the basics of Mutations and Queries.
Configuring env file:
To configure the project's environment variable file, follow the steps below:
- Step 1- Create an
.env
file at the root of the project; - Step 2- Copy the contents of the
.env.example
file to your new .env file; - Step 3- Paste your API_HTTP_LINK KEY into the variable API_HTTP_LINK
After the env setup, proceed with the steps below β
π How to execute the project:
To run and view the project, you will need to follow the next steps.
- First you must have Flutter installed in your machine, to know more about this, see the doc: https://flutter.dev/docs/get-started/install;
- Run the command to install the project dependencies.
flutter run
π Links:
Flutter:
https://flutter.dev/
Dart:
Dart docs
License
This project is licensed under the [MIT] license - see the LICENSE.md file for more details.