Beginner
How to Fetch an API in Flutter
Great applications should provide useful information to their users. Therefore, displaying data from other source (server) is necessary for most application. Fortunately, Flutter gives us convenient tools out of the box to do such thing.
In Dart language, we can use a package called http
. It’s a package that contains useful functions to send and retrieve data from HTTP server.
To install http
package, add the following package to your pubspec.yaml
file on your Flutter project.
Asynchronous Programming in Dart
Flutter is getting more popular than ever! But before you start learning the framework, you need to learn the programming language first. I know that’s annoying and it seems like a waste of time. But, that’s the challenge that every developer must face.
Dart is a powerful programming language by Google that aims to help developers to build web applications for both client and server, and now mobile apps with Flutter. Just like JavaScript, Dart is an asynchronous programming language. It means that you can run a piece of code without blocking any other tasks, even though, it runs in a single thread.