Network Request - Flutter Explained - Level: Beginner
Flutter Explained
Today we have a tremendous episode of Flutter Explained. I have the honour to explain to you guys how a future request works. In one of my episodes, I explained the future builder but I left the network request out of scope. Today I will turn this around, we ignore the UI and concentrate only on the Network request.
We will create a Person Model that is our representation of a Person from the API in Dart. The fromJson Constructor will be very handy in that situation to create for us the Person object. After that, we will create a Future request with the HTTP package from pub.dev to get all the information that we want to display.
⭐️⭐️ Helpful Ressources ⭐️⭐️ Repository: https://github.com/md-weber/network_request_tutorial Flutter JSON Serialization: https://flutter.dev/docs/development/data-and-backend/json
⭐️⭐️ Timeline ⭐️⭐️ 0:40 - pub.dev access the HTTP package (https://pub.dev/packages/http) 1:30 - random user generator API (https://randomuser.me/) 2:45 - explaining the boilerplate 3:50 - creating of the person model 5:50 - fromJson Constructor 9:20 - get the data/network service 10:55 - Dependency on the HTTP package 11:50 - Import the HTTP package 13:15 - Response object and Future 15:15 - Short Recap 15:50 - JSON and jsonDecode from dart:convert 17:45 - map the JSON to a Person object 18:45 - Complete the network request 22:40 - Challange 23:25 - Outro
⭐️⭐️ Follow me ⭐️⭐️ Twitter - https://twitter.com/max_myracle Github - https://github.com/md-weber Hashnode / Blog - https://hashnode.com/@Myracle
⭐️⭐️ Support ⭐️⭐️ If you read this so far, thank you once more. If you like to support me, here are some links that could help me a lot.
Buy me a coffee - You are free to donate me a coffee so I can keep up my work. https://www.buymeacoffee.com/MyracleDesign
Amazon Affiliate Link - You buy for the same price and I get a small amount of it. This leads to an amazing Flutter book that I can recommend to every beginner of flutter https://amzn.to/2uOJXON
For every developer a must-have and better said a must-read is the Clean Code book from Uncle Bob. https://amzn.to/2u5yXMP ... https://www.youtube.com/watch?v=hz2LQ43muio
146294077 Bytes