'Dealing with API endpoints in flutter
I have started learning to code since a few days back, and am only familiar with HTML/CSS/JS, and basics of dart/flutter
I am working on a Random quotes generator App project.
I HAVE THIS API ENDPOINT - https://winterly-backend.herokuapp.com/quote. Which returns a json like this
{"_id":"5ef5ad3cffd6b60fae11ad24","text":"I never think of the future. It comes soon enough.","author":"Albert Einstein"}
For a coding beginner like me. The whole idea of programing in flutter is amazing, but seems very daunting, or say complicated, while learning it.
QUESTION - Which is the fastest in way flutter that I can use to get the json, and use the values inside my widgets?
IS THERE A FLUTTER PACKAGE I CAN USE FOR THIS that can make the process faster and shorter?
Solution 1:[1]
Yes, install a Json to dart's converter plugin in intelij or vscode. use it to map json to a dart class, and then use DIO package for api calls.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Hosein Haqiqian |