ofload / native_updater

Flutter package to embed native in-app updater
MIT License
56 stars 48 forks source link

how get http statusCode? #18

Closed marleynoleto closed 3 years ago

marleynoleto commented 3 years ago

Hi, in example you describe that I need to get http status code by a requisition. You would send us a example? Or send to us a link thet document this process?

/// For example: You got status code of 412 from the /// response of HTTP request. /// Let's say the statusCode 412 requires you to force update int statusCode = 412;

thanks

milhomem commented 3 years ago

Hi @marleynoleto this is just an hypothetical case if you are using the http library to request your API. In this example you could look for status codes to control the update of the App remotely.

We use DIO and the Interceptors functionality to monitor all http requests and look for the http status code.

You can use any logic to trigger this module. Please let me know if you need a complete example and I can add one to the examples folder.

milhomem commented 3 years ago

Hi @marleynoleto @Sakib0604 , I will work on that and add a complete example with Dio.

sebastianbuechler commented 3 years ago

Would also be interested in your example with Dio. Thanks!

milhomem commented 3 years ago

Hi @marleynoleto @sebastianbuechler @Sakib0604

I hope this simple example in dede4df will help you. Let me know if you guys any question.

I've simply followed https://pub.dev/packages/dio#handling-errors guide.

Best,