Dio Connectivity Retry Interceptor - Flutter Tutorial

Поделиться
HTML-код
  • Опубликовано: 7 сен 2024
  • 📗 Learn from the written tutorial 👇👇
    resocoder.com/...
    📧 Get Flutter news 📰 and resources:
    👉 flutter.education
    👨‍💻 Do you write good code? Find out now!
    resocoder.com/...
    Performing HTTP requests is all fun and games until there's no internet connection. Sure, you can display a sad error message or a "Chrome dinosaur" to the user, but wouldn't it be better to take the initiative and automatically retry the request when the user connects to a WiFi network or enables mobile data? This is precisely what we're going to implement in this tutorial.
    Go to my website for more information, code examples, and articles:
    ● resocoder.com
    Follow me on social media:
    ● / resocoder
    ● / resocoder
    ● / resocoder

Комментарии • 92

  • @marekchojecki4746
    @marekchojecki4746 4 года назад +16

    Damn, you are video making beast. DDD twice a week plus „blue” tuts of librares. Im gonna buy you another coffee because I don’t think you sleep at all :)

    • @ResoCoder
      @ResoCoder  4 года назад +3

      Haha 😄 Thanks! When it comes to actual coffee, I drink a very conservative amount (for a programmer, at least 😅) 3 small cups a day.

    • @marekchojecki4746
      @marekchojecki4746 4 года назад +3

      Same here, but I have to be strong to not drink fourth :) Anyway bought you one but you deserved whole starbucks tbh for your effort. Keep goin 👊

  • @dangdatraymonddelmut3230
    @dangdatraymonddelmut3230 2 года назад +5

    This video is amazing and you are a good teacher. One issue I noticed is that when there is no Internet connection the circular progress indicator keeps looping infinitely, it would have been better you give user an error message instead of the infinite loop which left the user with no idea what was going on.

  • @waldherrweiss
    @waldherrweiss 4 года назад +4

    Great Video, as always.
    Just as a tip: You could use the any method of the Stream class to reduce the code of your scheduleRequestRetry function. It returns a future which completes with true when the given condition is true. In your case that would be the check if the ConnectivityResult is not none. Alternatively there's the await for Statement built into dart which is also syntactically nicer to read.

  • @luisrogelio98
    @luisrogelio98 4 года назад +2

    You thought it was your average Flutter tutorial but it was I DIO

  • @sumanparajuli229
    @sumanparajuli229 4 года назад

    Sir..... why i dont find you earlier.... Just today i found your youtube channel and i also enrolled your resocoder.com website...Just wow.. amazing content with clear visualization or explanation.... Just go on.. At the first day of enrolling your channel i become a fan boy from nepal....

  • @dennisszymanski4821
    @dennisszymanski4821 4 года назад +1

    Hey Matt.. I think it's fantastic, that you listen to "fan"-requested video-topics .. I really appreciate that .. So i want to drop my first video request: GraphQL with Flutter .. I don't know if this topic suits your channel, because I think that you would have to explain GraphQL first before you can jump into the Flutter related stuff .. But maaaaaybe if you dont have a better video idea you could do that .. I would really love to see your opinion and your implementation of that. But if you decide that this is no topic for a video on this channel I can understand that :) Anyway: Keep up the great work !

    • @ResoCoder
      @ResoCoder  4 года назад +2

      Hello Dennis! I've been thinking about making GraphQL tutorials for a while now, it's just not a topic which lends itself to one-off tutorials very well. I'd need to do a short series which I will not do right now BUT I think I'll be able to pull it off in the future.

  • @andreygritsay762
    @andreygritsay762 3 года назад +3

    With this approach you can't catch request errors as by default. It just won't work and so you can't show an error state to a user. It will be just an endless running function. It would be much better if you could show an error to a user and also schedule a retry request

  • @jimmyfmedina
    @jimmyfmedina 4 года назад +1

    Excelent video, very useful. This is one of my favorite channels to learn Flutter.

  • @shwepyisoe5240
    @shwepyisoe5240 3 года назад

    Thanks man. You're really saving my life. I won't forget your help.

  • @ilkercankaya3779
    @ilkercankaya3779 3 года назад

    you are a legend, best flutter tutorials ever. amazing!

  • @chetan6406
    @chetan6406 4 года назад

    Thanks matt for this series, absolutely really helpful content.

  • @wajeehulhassan_vii
    @wajeehulhassan_vii 4 года назад +7

    I was waiting for DDD part 5.

    • @jw4659
      @jw4659 4 года назад

      Me too - is the DDD tutorial over?

    • @alex_kenbo
      @alex_kenbo 4 года назад

      +

    • @arifikhsanudin9724
      @arifikhsanudin9724 4 года назад

      I waiting until it's done so that i can do marathon

  • @Im_Ninooo
    @Im_Ninooo 4 года назад

    1 minute into the video and I already like it :)

  • @coolprashantmailbox
    @coolprashantmailbox 4 года назад

    Thank you so much for this video, it's really helpful

  • @SachinKumar-ie7wh
    @SachinKumar-ie7wh 4 года назад

    Finally you came up with Dio. ☺️✌️.
    Dio Vs chopper. which one do you preffer?

  • @Sameer_Kumar
    @Sameer_Kumar 4 года назад

    Hey man!
    Brilliant tutorial. 👍
    Btw, which font scheme you are using here, looks impressive.

  • @kaushalzod5162
    @kaushalzod5162 3 года назад +3

    how did you created that snippet at 11:15 can you share please

    • @kaushalzod5162
      @kaushalzod5162 3 года назад

      "Class Creator From the name of File": {
      "prefix": "classFile",
      "body": [
      "class ${TM_FILENAME_BASE/(.*)/${1:/pascalcase}/} {",
      "$1",
      "}"
      ],
      "description": "Class Creator From the name of File"
      }

  • @MasterWingman
    @MasterWingman 3 года назад +1

    Can you please do a video on making a get request that requires basic authentication? I've been having a hard time with this.

  • @devqubs
    @devqubs 4 года назад +1

    why not use websocket to check connectivity to make sure server is really running?

  • @MohamedDernoun
    @MohamedDernoun 4 года назад +1

    Thanks for the efforts that you do, but please keep them short, TL&DR 😊

    • @ResoCoder
      @ResoCoder  4 года назад +2

      TL:Read the written article then 😉

    • @MohamedDernoun
      @MohamedDernoun 4 года назад

      ​@@ResoCoder reading the written excite you to watch the video, like a trap 😅

    • @ResoCoder
      @ResoCoder  4 года назад +1

      @@MohamedDernoun 😂 that's my evil goal.

  • @user-bx8uh4gl6s
    @user-bx8uh4gl6s 2 года назад

    Sir, thank you your video show, If I want to useing the Dio 4.0.4 to do "scheduleRequestRetry" method, how can I do?

  • @ranskiseee
    @ranskiseee 3 года назад +1

    Please help in dio version 4.0

  • @verryondrums
    @verryondrums 4 года назад

    Always pressing like before event watching it ^^

  • @mithuns8410
    @mithuns8410 4 года назад +1

    how can i add Dio caching to this interceptor?

  • @kulwinderrahal6941
    @kulwinderrahal6941 4 года назад +1

    i am native android developer and used retrofit in all of projects, now i’m working on flutter and starting new project which option is best DIO or CHOPPER ?

  • @nicoteufel
    @nicoteufel 4 года назад +2

    When you're working on an own project, do you plan your app down to the smallest detail?

    • @ResoCoder
      @ResoCoder  4 года назад +4

      No, I plan the most important parts as a high-level overview and then plan out small chunks as we go.

  • @suryasingh9763
    @suryasingh9763 4 года назад

    great work Man!!

  • @etiennetheodore
    @etiennetheodore 3 года назад

    Hi thanks for the video !! Do you have any idea how to unit test this custom interceptor ?

  • @AiEnthusiast999
    @AiEnthusiast999 3 года назад

    big thank you !!!

  • @vivekjunghamal5730
    @vivekjunghamal5730 2 года назад

    there are lot of changes in current dio : 4.0. Any workaround to this. Like now function doesn't return future but returns void

  • @loicfonkam9206
    @loicfonkam9206 4 года назад

    Thanks for the tutorial!
    Can we get the retry functionality with chopper?

  • @jatinchaudhary383
    @jatinchaudhary383 3 года назад

    Which vs code theme you are using including the font style as it is looking attractive

  • @programan6391
    @programan6391 4 года назад +2

    Code coverage in flutter is very unclear, I would like to see you explain that.

  • @medamoniaravind8092
    @medamoniaravind8092 4 года назад

    i want to show the network connectivity error message screen to the user how to do please reply me, thank for your awesome tutorials on flutter

  • @h3w45
    @h3w45 4 года назад

    Please make a video about asynchronous programming in flutter.

  • @andreybudnikov5920
    @andreybudnikov5920 3 года назад

    Tell me. 3:26 min, you clicked a button and the editor displayed the line of code that was causing the problem. How did you do this? Is this some kind of editor plugin?

  • @sergiofranklin8809
    @sergiofranklin8809 4 года назад

    How did you learn Flutter? From which tutorials or books, give some recommendations please

  • @hamidjahandideh8142
    @hamidjahandideh8142 4 года назад

    please make some video for BDD
    or some video for TDD vs DDD vs BDD vs ATDD
    thanks reso

  • @berthojoris
    @berthojoris 9 месяцев назад

    Hi reso, please update with new version of dio please :)

  • @top10top54
    @top10top54 3 года назад

    Is there any way to pause, resume and download using dio Package? I need dio show download progress that can be resumed and paused... Help

  • @muhsinzyne695
    @muhsinzyne695 2 года назад

    Hey is there any breaking changes .? for flutter new version ..?

  • @skirllexrude8170
    @skirllexrude8170 2 года назад

    Reso i am using dio interceptor but 304 status caught in onerror callback is there any workaround to send it as response to the calling function

  • @easazade
    @easazade 4 года назад

    thanks man, 👍❤

  • @dipeshkhanal7407
    @dipeshkhanal7407 3 года назад

    Nowadays the null safety brings lots of change, can you please make the video again for dio 4.0.0

  • @amrinjaffni4268
    @amrinjaffni4268 4 года назад

    anyone knows how to change a certain keyword's color? currently I'm using Material Theme Darker, but somehow my "this" keywords remain in white color

  • @fredili3002
    @fredili3002 10 месяцев назад

    @Reso Coder help this video is 3 years ago and its no longer working how do i fix it

  • @vahaggrigoruyan7228
    @vahaggrigoruyan7228 Год назад

    socketException(socketException: Failed host lookup: ' ' (os error: no address associated with hostname. errno =7))
    Hello whatever i do in the debug mode it stops untill i hit the play button and in the stack there is this error please help me with it i am stuck on it for days already

  • @thegorilla8395
    @thegorilla8395 3 года назад

    dio vs http ? which package i should choose ?

  • @nourshobier3157
    @nourshobier3157 4 года назад

    The font you are using is awesome, what's its name?

  • @Adnankhan-jr3gz
    @Adnankhan-jr3gz 4 года назад

    i am requesting you to make a video on refresh token in interceptors by using Dio.

  • @mahesh8948
    @mahesh8948 4 года назад

    How can I implement for token expire scenario.

  • @wavemusic7153
    @wavemusic7153 3 года назад

    How can we use thi code for whole app connectivity

  • @mithuns8410
    @mithuns8410 4 года назад

    Could you please add dio caching for http data

  • @TestThenPush
    @TestThenPush 4 года назад

    Can you please tell how can I achieve this functionality with Chopper?

  • @mike_zander
    @mike_zander 2 года назад

    When the device goes to sleep and wakes up is there any way to resume download?

  • @musliminontong2918
    @musliminontong2918 Год назад

    Please update the video

  • @programan6391
    @programan6391 4 года назад

    Hey Matt, how are doing your country/city?

    • @ResoCoder
      @ResoCoder  4 года назад +1

      We're in a semi-enforced lock down mode. No deaths yet, thankfully.

  • @NotAChannel4
    @NotAChannel4 4 года назад +1

    invalid link

  • @polyrtm5545
    @polyrtm5545 4 года назад

    KONO DIO DA

  • @Mayanktaker
    @Mayanktaker 4 года назад

    Make Flutter WordPress Graphql video please

  • @petscutest2055
    @petscutest2055 4 года назад

    what is your font name

  • @adenaziz3600
    @adenaziz3600 4 года назад

    would you mind share your vscode settings & extensions?
    i don't have that inheritance line in your editor like:
    ---child: xx
    | mainAxis
    | children
    |------

    • @ResoCoder
      @ResoCoder  4 года назад +1

      Sure, it's actually a part of the Dart extension. dartcode.org/releases/v3-4/#flutter-outline

    • @adenaziz3600
      @adenaziz3600 4 года назад

      @@ResoCoder thank you!

  • @danvilela
    @danvilela 4 года назад +1

    "very nice looking UI".. an app bar, a text and a button LOL

  • @arifikhsanudin9724
    @arifikhsanudin9724 4 года назад

    How much is your ram?

  • @faizulla5838
    @faizulla5838 2 года назад

    where is code? bro ))

  • @thedude61636
    @thedude61636 3 года назад

    it's not DAIOO
    it's me dio

  • @plebulus
    @plebulus 4 года назад

    I would never try trust something named DIO