Login Page using Api in Flutter

admin@crackerworld.in Avatar

Login Page using api in Flutter:To prevent unauthorized access to personal information, it is a good practice to authenticate users before granting access to websites, mobile applications, and computer applications, after then register and then login. In this article, we are going to explain how to build a Design Login page user interface. We have used the TextField widget, for user input as Username/Email,  and Password. And below of password TextField to create the option Forget Password. Button widget, to show action.

Add This http package into your pubspec.yaml file so you can user latest version of this package from this link and import this package into project dart file.

We will use these free API servicse to get End Point to of our login API.

Create your project and design the UI, we will use TextFormField widget to get input from the user i.e email and password. We will to controller email controller and password controller to keep the text in this controller which will user enter in the TextFormField widget.

email TextForm Field

password TextForm Field

Let create the button, when user click on this button we will then call the Login API.

Source Code of Function To Call Login API.

Here we will create a post request using our http package library and then we will send a request to the server. If the response status code is equal to 200 then it means the user is logged in and we have a user token.

Login API

Full Code:Login Page using api in Flutter

Login Page using api in Flutter
Login Page using api in Flutter

Tagged in :

admin@crackerworld.in Avatar

Leave a Reply

Your email address will not be published. Required fields are marked *

More Articles & Posts