Flutter Networking Tutorial: Getting Started | raywenderlich.com

In this tutorial, you’ll learn how to make asynchronous network requests and handle the responses in a Flutter app connected to a REST API.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/5896601-flutter-networking-tutorial-getting-started

93mb the download materials?! really. Please some of us have limited internet connection. it will be greatly appreciated a reduction on that size or at least splitting backend from app.

Hey @croxx5f
Sorry for the inconvenience caused due to the download size. Currently all the project materials can only be provided through one downloadable link. I made sure that I clear the caches from the projects to reduce the size to minimum. But I will surely take this feedback and try to provide the download materials in smaller sizes.

If you need them in smaller chunks let me know. I will upload them individually here for you.

Hi, @sagarsuri. Thanks for your prompt and polite answer. And really thank you for your article and good work. I do know there are lots of things to take into account to deliver high quality material, so an edge case like slow/metered connection issue from a single user is not the kind of thing you anticipate.But If you could upload just the flutter project i will greatly appreciate it. I was curious to see the implementation of api consumption via streams since i traditionally do it with futures. But had a few shortcomings in my last projects . And also the response class(As it seems to be a wrapper for values in the spirit of either or Try monads) and I am currently interested in them for the http communication/response layer and how those abstractions enforce you to take into account the error cases and give you sintactic clarity that a method may return an error. Sorry for this quite long writing but I was really interested in the topics you explained and wanted to transmit it.
Thanks for everything and apologies for my quite rude comment.

I loved the tutorial however when I add a new book even though I receive a successful response that the record was added the list view doesn’t display the new entry. If I run the GET request in postman the new entry appears. I even print out the size of the book collection in the aqueduct console and that too shows the new record being added to the collection. Any ideas what could be wrong ?

Hello,

I guess, Sample projects are not working. I believe main app is correct. But Deployed REST Apps ( Aqueduct ) has a problem. get, post and delete could not get a response. Could you please check final projects from download materials.

It appears the backend is working correctly because if I execute the get,post and delete methods via postman I see the correct results.

hello, Can you please check GET response with https://jsonformatter.curiousconcept.com/. It looks work.

Hey @falcod and @durul

May I know where you guys are running the app? Is it an iOS simulator or an Android emulator?

Sure, I used Android simulator

Hey @durul
Did you try the following when using Android emulator?

If you are following along with the tutorial using an Android emulator, you need to run this command in a Terminal window after you startup the emulator, in order to have correct port forwarding from the emulator: adb reverse tcp:8888 tcp:8888 . The adb version you use must be the one inside your local Android SDK installation, which is often in ~/Android/Sdk/platform-tools . The output from the command should be the port 8888.

I am using iOS simulator. And as mentioned the backend is working fine with postman. I also print out the size of the collection before and after the post method and the totals are correct. When I go back to the browser I do not see the updates either almost as if the collection was cached.

Hi, I tried them all. Here are my screenshots Android and iOS.

Simulator Screen Shot - iPhone 8 - 2020-04-20 at 23.29.55 Screenshot_1587439606

1 Like

Also, my screenshots all look correct it just after adding a book the list view still contains the original entry even though logging on aqueduct server shows new record added with the appropriate success message. Delete appears to be working correctly from UI.

@falcod
When you add a new book. It is added at the bottom of the list. I have re-tested the apps in the download material and it’s working as expected. I didn’t face any such issues.
Can you submit the project which you are working on? I will look at the implementation.

Hey @durul
Can you submit the project which you are working on? I would like to debug it and find out the actual cause. I have re-tested the apps in the download materials and it’s working as expected.

Hey @falcod
I am not using any database in the backend app. The changes will only be available per deployment. Make sure you are not re-deploying the backend after the changes. Hope this helps.

Hello Sagar, you can download my project files from this link.

Hi @sagarsuri - my apologies - this is working perfectly for me on both iPhone and android. There was a silly error on my part. Sorry for the inconvenience. Great tutorial !

1 Like

Great tutorial. I’m an intermediate Dart/Flutter who needs to get up to speed on restful APIs and this article fit my needs perfectly. Five stars. I particularly like that you provided a Dart backend. I know this tutorial didn’t focus on the backend, but I’m wondering how to run the backend in the debugger and set breakpoints so that when the emulator makes requests we can step thru the backend responding? That would be pretty cool!