Flutter | POST Data To Server In JSON Format Through API Using Dio | PHP API

  Рет қаралды 2,539

Unpossible POG

Unpossible POG

Күн бұрын

Flutter | POST the JSON Data Through API Using Dio | PHP as a Backend
-------------------------------
Install XAMPP Tutorial:-
• How to Install XAMPP S...
Blog Link:-
unpossiblepog....
Download Project:-
unpossiblepog....
Subscribe my Channel:-
www.youtube.com...
Facebook Page:-
/ unpossiblens
Twitter Account:-
/ unpossiblepog
Blog:-
unpossiblepog....
Website:-
unpossiblepog....
Gaming Instagram:- (@unpog.gaming)
/ unpog.gaming
-------------------------------
In this tutorial, we shall create a project which can send data through API using GET & POST Methods.
We shall be using a PHP as a back-end language for the API and shall store the JSON in database.
We shall be referring a blog which contains steps to approach the task. Link of that blog is giving in the description.
First step is to create an empty Flutter project.
From 2nd step, copy-paste the whole code and paste it in main.dart file.
For 3rd step, open pubspec.yaml file and add those 2 lines under dependencies.
Make sure it is at the same level as flutter, then click on PUB GET to download important libraries.
We completed 4th point, and for the 5th point, we have to install XAMPP which will create a local domain in your computer. This will help us to create an API.
Link for XAMPP installation tutorial is given at the right-top-corner.
I already installed it so I am going to run it.
In 7th step, I shall create a database table by copy-pasting the SQL query in PHPMYADMIN.
First create a database called “test”. Click on it, and click on SQL tab.
Paste the QUERY there and execute it.
In next step, we have to create a folder called “flutter_test” in htdocs folder and then create an empty PHP file in it. Give it a name as “store_data_flutter.php”
Open that file in any text-editor, and copy-paste the code from step 9.
At last, open a command prompt and type command IPCONFIG.
Search for IPv4.
Choose any one from IPv4 and make sure that it is same an IP in flutter code. If not, then replace IP address to the one shown in your command prompt.
In response, an API returns a JSON which is displayed in console.
And when we go back to phpmyadmin, and check the table data, you will see our entered data there.
To switch from POST to GET, change function name to get. Also, in PHP code, change $_POST to $_GET.
You can download a whole project from my website.
A download link is given in the description.
Thanks for watching. Like share and subscribe.

Пікірлер: 1
@thazeroword646
@thazeroword646 2 жыл бұрын
Very nice tutorial
Display Data From a JSON in Flutter
7:11
Programming Addict
Рет қаралды 124 М.
АЗАРТНИК 4 |СЕЗОН 3 Серия
30:50
Inter Production
Рет қаралды 947 М.
💩Поу и Поулина ☠️МОЧАТ 😖Хмурых Тварей?!
00:34
Ной Анимация
Рет қаралды 1,5 МЛН
Fake watermelon by Secret Vlog
00:16
Secret Vlog
Рет қаралды 16 МЛН
How Create(Post)data on the server with Dio in Flutter?
8:34
flutter school
Рет қаралды 1,7 М.
Flutter : Post api implementation with dio | amplifyabhi
11:53
amplifyabhi coding
Рет қаралды 8 М.
Laravel From Scratch | 4+ Hour Course
4:18:52
Traversy Media
Рет қаралды 1 МЛН
What is the Future of Software Development?
22:10
IAmTimCorey
Рет қаралды 62 М.
Flutter | Create A Scrollable Pagination | Horizontal
6:48
Unpossible POG
Рет қаралды 303