https://github.com/parikshitg/flutter_api_call
This projects demonstrate how to make api call in flutter. It uses a Go service for making api calls.
https://github.com/parikshitg/flutter_api_call
flutter golang rest-api
Last synced: 3 months ago
JSON representation
This projects demonstrate how to make api call in flutter. It uses a Go service for making api calls.
- Host: GitHub
- URL: https://github.com/parikshitg/flutter_api_call
- Owner: parikshitg
- Created: 2021-09-11T18:41:42.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-09-15T15:50:46.000Z (over 4 years ago)
- Last Synced: 2025-03-30T09:01:49.343Z (about 1 year ago)
- Topics: flutter, golang, rest-api
- Language: Dart
- Homepage:
- Size: 2.44 MB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# FLUTTER API CALL

This projects demonstrates the ideal way to make api calls in flutter. The app consists of a basic auth flow. User can register, login, update its credentials and remove from the app covering the basic http methods GET, POST, PATCH, DELETE.
The project-repo consist of two directories, **flutter_client** (our frontend client app written in flutter) and **go-server** backend server written in golang. The go-server is a small API based microservice written using gin-gonic.
### REQUIREMENTS
* Computer
* Golang
* Flutter
### RUN
To run golang backend server:
```
cd flutter_api_call/go-server
make run or go run main.go
```
To run flutter app:
```
cd flutter_api_call/flutter_client
flutter pub get
flutter run
```
### API SPECS
Some common structures:
```
Status{
Success `json:"success"` // boolean
ErrorMessage `json:"error_message"` // string
}
Response{
Status `json:"status"` // Status
}
User{
Name `json:"name"` // string
Email `json:"email"` // string
}
```
#### __/register__
```
* Method: POST
* Request: RegisterRequest{
Email `json:"email"` // string
Name `json:"name"` // string
Password `json:"password"` // string
ConfirmPassword `json:"confirm_password"` // string
}
* Response: Response{}
```
#### __/login__
```
* Method: POST
* Request: LoginRequest{
Email `json:"email"` // string
Password `json:"password"` // string
}
* Response: LoginResponse{
Name `json:"name"` // string
Email `json:"email"` // string
}
```
#### __/list__ (lists all the users)
```
* Method: GET
* Response: ListResponse{
Status `json:"status"` // Status
Users `json:"users"` // []User
}
```
#### __/update-password__
```
* Method: PATCH
* Request: UpdateRequest{
Email `json:"email"` // string
OldPassword `json:"old_password"` // string
NewPassword `json:"new_password"` // string
ConfrimPassword `json:"confirm_password"` // string
}
* Response: Response{}
```
#### __/delete__
```
* Method: DELETE
* Request: DeleteRequest{
Email `json:"email"` // string
Password `json:"password` // string
}
* Response: Response{}
```