This project was created for a tutorial on how to build a Flutter application that consumes a GraphQL API using Hasura. The application demonstrates how to fetch, insert, update, and delete data from the API in a clean and efficient way.
This project covers the following topics:
- Setting up Hasura and configuring a PostgreSQL database
- Creating GraphQL queries, mutations, and subscriptions
- Integrating GraphQL in a Flutter application using
graphql_flutter
- Building a simple CRUD application that interacts with the API
- Flutter and Dart SDK
- Android Studio or Visual Studio Code with Flutter and Dart plugins
- Docker (for Hasura and PostgreSQL setup)
- Clone the repository:
git clone https://codeberg.org/betazetadev/graphql-flutter-client.git
- Change into the project directory:
cd flutter-graphql-hasura-tutorial
- Install the dependencies:
flutter pub get
- Run the Docker container with Hasura and the PostgreSQL database:
docker-compose up -d
-
Import and create the database information using this files connecting to the virtualized database.
-
Add a
code
column to thelanguage
table with the default value set togb
(they are used to show a flag next to the film information):
Language | Code |
---|---|
English | gb |
Japanese | ja |
Mandarin | ma |
French | fr |
German | ge |
Italian | it |
- Reload Hasura metadata to get the new column from the settings menu placed in the right upper corner of the admin panel listening in the local port 8080. You don't need to do this if you add the
code
column from the Hasura admin panel.
This project is licensed under the MIT License. See the LICENSE file for more information.