Skip to content

This projects demonstrate how to make api call in flutter. It uses a Go service for making api calls.

Notifications You must be signed in to change notification settings

parikshitg/flutter_api_call

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

FLUTTER API CALL

Register Screen

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{}

About

This projects demonstrate how to make api call in flutter. It uses a Go service for making api calls.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published