I have a project in which I have a Python database and I have a Flutter ui.
Is there anyway I can use the REST API to connect them? My teammates who do the backend state that their database will use the REST API, so it would be useful if I can do that.
Yes, you can easily use REST API's with Flutter.
Dart offers an http
package for easy HTTP request and there are others available on Dart Pub.
With the http
package, you can even integrate your REST API request into the build tree very easily using a FutureBuilder
:
FutureBuilder(
future: http.get('https://your-rest-api-domain.xyz/get-images?amount=5'),
builder: (context, snapshot) {
// you can easily work with your request results in here and return a widget
},
)
As cricket_007 mentioned in a comment, Flutter also provides a cookbook entry on this topic.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With