Flutter Offline Rest API Data Sync

แชร์
ฝัง
  • เผยแพร่เมื่อ 24 ต.ค. 2024

ความคิดเห็น • 121

  • @SnippetCoder
    @SnippetCoder  3 ปีที่แล้ว +1

    Please subscribe to this TH-cam channel and click on the bell button so that you get updates on our videos. Thank you.
    th-cam.com/users/SnippetCoder

  • @rohitkumarsingh6925
    @rohitkumarsingh6925 3 ปีที่แล้ว +8

    Snippet Coder is the King of Flutter 🔥

  • @gsilva877
    @gsilva877 ปีที่แล้ว +2

    Proper offline experience is more sofisticated than that. But you give me idea for a start. Thanks

  • @cethartest469
    @cethartest469 3 ปีที่แล้ว +3

    really good work,
    note : why not add time for refresh data,
    i mean when stored data, automatically add addedDate to sqlite, when retrive data check addedDate if more than 7 (e.g) days , make http request and replace data

    • @SnippetCoder
      @SnippetCoder  3 ปีที่แล้ว +3

      Already in Pipeline for next Update of plugin

    • @DiazGunturFebrian
      @DiazGunturFebrian 2 ปีที่แล้ว

      @@SnippetCoder this is good

  • @anwarshehata8502
    @anwarshehata8502 3 ปีที่แล้ว +6

    very excellent explanation ... But in the case of deleting or adding products from the control panel, how do I delete the old cache and make a new cache?

    • @SnippetCoder
      @SnippetCoder  3 ปีที่แล้ว +3

      Call deleteCache(key) in delete product. Then Call addCache method

  • @AlexanderSuraphel
    @AlexanderSuraphel 2 ปีที่แล้ว +2

    If I understood correctly you're giving the cache generic names such as API_Products etc.. but the data you're storing on it is filtered by params such as "searchStr". Wouldn't that cause cache hit even after the "searchStr" is changed?

  • @AswanathCK
    @AswanathCK 2 ปีที่แล้ว +2

    Hello bro,
    Once I cache all the data, Then when the user restarts the app we need to call the api data right?(otherwise it will never update). So, will it be good to clear the cache in the main function?.

  • @GowthamkumarM-zx3no
    @GowthamkumarM-zx3no ปีที่แล้ว +2

    Nice Video brother. Thanks for sharing the information... Keep post the videos... ☺

  • @samkitshah7892
    @samkitshah7892 3 ปีที่แล้ว +1

    great video i have a question how will it take if we go to next page or increment the page ?? and how to display products with different category id ?? how to implement both in this package??

    • @simonpetera2486
      @simonpetera2486 3 ปีที่แล้ว

      We should think these points before implementing this package in a project...

    • @SnippetCoder
      @SnippetCoder  3 ปีที่แล้ว

      Yes we can do these also by outting some logic in the code to handle the pagination , ping me offline to discuss

    • @simonpetera2486
      @simonpetera2486 3 ปีที่แล้ว

      I think we can use dynamic keys to handle pagination and different category_id's...

    • @samkitshah7892
      @samkitshah7892 3 ปีที่แล้ว

      @@SnippetCoder yes okay i also thought about another thing what if someone added a new category or product so how will it add new category or product to the storage?
      dont get it wrong u have created an awesome work by creating this package

  • @MohammadAlbazel
    @MohammadAlbazel 3 ปีที่แล้ว +1

    Amazing stuff, its a WOW
    it could be better if you store the keys in variables.
    What will happen if the data changes in the online DB or local DB, how to synch???

    • @SnippetCoder
      @SnippetCoder  3 ปีที่แล้ว +3

      That i will cover in Version 2.0 of the plugin, Soon Details video coming with package update.

    • @اسروكورة
      @اسروكورة 3 ปีที่แล้ว

      ​ @Snippet Coder thank you but when

  • @biakneisang4011
    @biakneisang4011 2 ปีที่แล้ว +1

    my data from api request is not only text, but also image. Image can also be cached in local ?

  • @johnsangpi2523
    @johnsangpi2523 2 ปีที่แล้ว

    please can you tell us how to make data sync? at the first time, it fetches from api and stores in local and second time, it gets from local, in here if the back-end db is updated, how can i get the update data by making data sync? my back-end db is local MongoDB with nodeJS

  • @Sj-rj5pp
    @Sj-rj5pp 3 ปีที่แล้ว +2

    Great sir. This plugin is life saver. How you create those plugins?

    • @SnippetCoder
      @SnippetCoder  3 ปีที่แล้ว +2

      Will make the video for this soon :)

    • @divyanshusharma3161
      @divyanshusharma3161 3 ปีที่แล้ว

      @@SnippetCoder yes.. I want to learn that.❤️

  • @dasaintgray
    @dasaintgray 2 ปีที่แล้ว

    HI i tried to implete your API_Cache there's an exception after saving the data
    exception: Row too big to fit into CursorWindow requiredPos=0, totalRows=1; query: SELECT * FROM api_cache_data WHERE key = ?

  • @essohlewijeanmarc7832
    @essohlewijeanmarc7832 2 ปีที่แล้ว

    Hello sir thanks for all tutoriels please Can you show us how to display a Notification Count Badge over App Icon,like WhatsApp, Facebook ?

  • @roopaish
    @roopaish 2 ปีที่แล้ว +1

    wow thank you so much. it worked flawlessly

  • @RajeevKumar-pw6we
    @RajeevKumar-pw6we 3 ปีที่แล้ว

    How to be sure local db is in synchronisation with server db.. if more than one user try to change the same data or maintain unique Id if inserting different data

  • @narayankanti
    @narayankanti 3 ปีที่แล้ว +1

    Nice video..
    Can i get a sample code? As i am new to flutter and i need to add this to my currently working project.

  • @maririn0312
    @maririn0312 2 ปีที่แล้ว +1

    thank you sir it's very very helpfull

  • @gameStreamerLoco
    @gameStreamerLoco 3 ปีที่แล้ว +1

    how to query the data saved to local database with this package??

  • @xpwahab1
    @xpwahab1 3 ปีที่แล้ว +1

    Nice video.
    How is this better than Hive or shared preferences? I'm new to flutter and programming in general

    • @SnippetCoder
      @SnippetCoder  3 ปีที่แล้ว +2

      By using this package you have to do 2-3 lines of code. but with hive you have to write your own mechanism to handle all this. For shared preference I will not recommended because in case your device is out of memory your shared preference get cleared automatically.

    • @xpwahab1
      @xpwahab1 3 ปีที่แล้ว

      @@SnippetCoder Thank you!

    • @SnippetCoder
      @SnippetCoder  3 ปีที่แล้ว +1

      I hope you subscribed to the channel, if not please do the same.

    • @AswanathCK
      @AswanathCK 2 ปีที่แล้ว

      @@SnippetCoder Your package is amazing brother. I have one suggestion. If it uses the Hive database then the performance will be much better. Right?

  • @nikhilkukreja8498
    @nikhilkukreja8498 3 ปีที่แล้ว +1

    God bless you sir 🙏❤️

  • @stijn1989
    @stijn1989 2 ปีที่แล้ว

    Yes another package that just stores JSON in SQLite. That's not really offline support. Offline API heu? What if you do a POST request to store it on the backend?
    Just use the Hive library (which is faster then SQLite btw) and store your JSON in the Hive box.

  • @thaliaamargianou7870
    @thaliaamargianou7870 3 ปีที่แล้ว

    what can I say..! You are the best! Congrats...!

  • @DailyFeed666
    @DailyFeed666 ปีที่แล้ว

    Question sire, if there is a new data in the response, how to update the local cached with the new set of api data 😊 or ???

    • @SnippetCoder
      @SnippetCoder  ปีที่แล้ว

      With the help of push notifications, from backend send push notifications and based on that update the data in apicachemanager

  • @Damien-cr9sw
    @Damien-cr9sw 3 ปีที่แล้ว

    Suppose any changes in data made byoffline , does it reflects cloud? Like if we update a product price in offline , does it change in cloud when it recieves data connection?

    • @SnippetCoder
      @SnippetCoder  3 ปีที่แล้ว +1

      Hello, As of now no such feature, but promise, in future will share this feature in the package :)

  • @SkjoyBd
    @SkjoyBd 3 ปีที่แล้ว

    Great package. It will help me a lot. But one thing I can not understand, If has cache data, then It won’t' make the API call, right? So how do we get updated / latest data from API?

    • @SnippetCoder
      @SnippetCoder  3 ปีที่แล้ว +1

      Very soon video for V2.0 will come then all your questions will be automatically answers.

    • @SkjoyBd
      @SkjoyBd 3 ปีที่แล้ว

      @@SnippetCoder Waiting... 😍

    • @zraudiovlogs7044
      @zraudiovlogs7044 2 ปีที่แล้ว

      @@SnippetCoder Hi any update for V2.0 need this function

  • @mdabdurrahman6899
    @mdabdurrahman6899 ปีที่แล้ว

    User internet connection off, user add category sava data offline, user come online auto new data upload api. How to make it?

  • @osmankocak1
    @osmankocak1 3 ปีที่แล้ว +2

    Very helpfull channel

  • @freezman5041
    @freezman5041 3 ปีที่แล้ว

    You are the best bro 🔥
    But this plugin need a timer for deleting cached data !

    • @SnippetCoder
      @SnippetCoder  3 ปีที่แล้ว

      That you can do manually as per your requirement

    • @zraudiovlogs7044
      @zraudiovlogs7044 2 ปีที่แล้ว

      @@SnippetCoder How can you add a timer

  • @mirmoktadir2170
    @mirmoktadir2170 2 ปีที่แล้ว +1

    What a great work brother...thanks a lot.

  • @AjilSathyanLMCEC
    @AjilSathyanLMCEC 3 ปีที่แล้ว +2

    How to update this data in api cache manager when the API data is added and how to update and show in UI without changing the Key

    • @SnippetCoder
      @SnippetCoder  3 ปีที่แล้ว +3

      Just call the same method of addcachedata, it will automatically update the cache on the basis of key name

    • @AjilSathyanLMCEC
      @AjilSathyanLMCEC 3 ปีที่แล้ว

      @@SnippetCoder Thanks you so musch.❣️ Can I use it in Todo app for daily task instead of Sqflite.?

  • @dasaintgray
    @dasaintgray 2 ปีที่แล้ว

    How to delete specific records on the sync data?

  • @divyanshusharma3161
    @divyanshusharma3161 3 ปีที่แล้ว +1

    This is awesome ... thanks for your efforts🤘❤️

  • @abc867
    @abc867 3 ปีที่แล้ว

    I have used this package and it's a good one. I have a doubt that when i upade the data in API How to restore that data from API while the Internet is ON?

    • @SnippetCoder
      @SnippetCoder  3 ปีที่แล้ว +1

      Will make the details video soon with update of package V2.0

    • @abc867
      @abc867 3 ปีที่แล้ว

      @@SnippetCoder thanks

    • @vikashtiwari2175
      @vikashtiwari2175 3 ปีที่แล้ว

      @@SnippetCoder but when??

    • @SnippetCoder
      @SnippetCoder  3 ปีที่แล้ว

      Already on it bro, within this coming week :)

    • @abc867
      @abc867 3 ปีที่แล้ว

      Where is the updated video?

  • @BDWATCHLEARN
    @BDWATCHLEARN 3 ปีที่แล้ว

    When should we use that? How we will know new data add or not if we load from catche data

    • @SnippetCoder
      @SnippetCoder  3 ปีที่แล้ว +1

      it is simple, on the new category save if status code = 200 then call this await APICacheManager().deleteCache("API_CATEGORIES");
      Then when we call categories page, it will automatically call API first time, because we have deleted the key and it will again add fresh data.

    • @allanguintu
      @allanguintu 3 ปีที่แล้ว

      @@SnippetCoder what if the changes are made by the admin and not by the app itself.. how is the app going to detect changes?

  • @abdulkhalik759
    @abdulkhalik759 2 ปีที่แล้ว

    when this cache will be refreshed

  • @Tech1st
    @Tech1st 3 ปีที่แล้ว +1

    If user add new category is automatically sync from api?

    • @SnippetCoder
      @SnippetCoder  3 ปีที่แล้ว +1

      it is simple, on the new category save if status code = 200 then call this await APICacheManager().deleteCache("API_CATEGORIES");
      Then when we call categories page, it will automatically call API first time, because we have deleted the key and it will again add fresh data.

    • @Tech1st
      @Tech1st 3 ปีที่แล้ว

      @@SnippetCoder ncie.. when our connection offline its automatically detect?

    • @SnippetCoder
      @SnippetCoder  3 ปีที่แล้ว +1

      ​@@Tech1st No need to check anything, app will behave normally as, first time it will save the data in local and next time data will be read from local db itself

    • @Tech1st
      @Tech1st 3 ปีที่แล้ว

      @@SnippetCoder this package doesn't have Example ,Can u provide ?

  • @CarlosWashingtonMercado
    @CarlosWashingtonMercado 5 หลายเดือนก่อน

    Is this opensource?

  • @gumdum6764
    @gumdum6764 3 ปีที่แล้ว

    This looks nice, but how do I know you aren't storing this and pushing it to a remote server? There is no way to verify these endpoints that I can see...in other words, there is no source code. With out source, I'd not trust this without some form of End User Agreement with you to use your closed source plugin. Am I right? 🥴

    • @SnippetCoder
      @SnippetCoder  3 ปีที่แล้ว +1

      Source code will be up soon :) here everything we are doing only for testing/education purpose.

  • @ahmedalial-selmy895
    @ahmedalial-selmy895 3 ปีที่แล้ว +1

    Excellent 👍

  • @ezalor9555
    @ezalor9555 3 ปีที่แล้ว +1

    Very good video!

  • @Bfas237Forum
    @Bfas237Forum 3 ปีที่แล้ว

    Hey bro, nice tutorial, can i get a sample use case? (A sample code with implementation)
    Thanks in advance

    • @Bfas237Forum
      @Bfas237Forum 3 ปีที่แล้ว +1

      Oh! I was able to make it work. Thanks for this awesome package.
      When will image support be available?
      It will be awesome if that were true

  • @codboxer
    @codboxer 2 ปีที่แล้ว

    if any new product is added to the server, is it saved in the cache based on this code ?????

    • @SnippetCoder
      @SnippetCoder  2 ปีที่แล้ว

      No , for that you have to deal with push notification, upon getting the push notification update the cache based on new data.

  • @kingmega8730
    @kingmega8730 3 ปีที่แล้ว +1

    Thx sir

  • @اسروكورة
    @اسروكورة 3 ปีที่แล้ว

    you are the best thank you

  • @ricardo-emerson
    @ricardo-emerson 3 ปีที่แล้ว

    Hi congratulations by the package it is awesome!! Do you can create a method to list all stored keys? That will be good.

    • @SnippetCoder
      @SnippetCoder  3 ปีที่แล้ว +1

      Sure noted will add the same

    • @ricardo-emerson
      @ricardo-emerson 3 ปีที่แล้ว

      @@SnippetCoder Thanks man. Do you have an idea when it will be available? I'm going to need this functionality in an app I'm developing.

    • @SnippetCoder
      @SnippetCoder  3 ปีที่แล้ว +1

      I will try to update this functionality asap over the weekend.

    • @ricardo-emerson
      @ricardo-emerson 3 ปีที่แล้ว

      @@SnippetCoder Thanks I am waiting for this update.

  • @maririn0312
    @maririn0312 2 ปีที่แล้ว

    and then how can i get data from my cache ?
    pls help about it

    • @SnippetCoder
      @SnippetCoder  2 ปีที่แล้ว

      By calling this : getCacheData(keyName)

  • @matiasvirasoro
    @matiasvirasoro 3 ปีที่แล้ว +1

    Long live the King!!!

  • @prashantnigam6698
    @prashantnigam6698 3 ปีที่แล้ว

    But sir data updated kese hoga is ne first time he database fetch kar local save kar deya and je bas je check kar raha h data locally store h ya nahi je nahi dek raha ke local data updated h ya nahi

    • @SnippetCoder
      @SnippetCoder  3 ปีที่แล้ว

      In next update of package, auto data update feature will be added

    • @prashantnigam6698
      @prashantnigam6698 3 ปีที่แล้ว +1

      @@SnippetCoder thanks sir i waited.

  • @mohammedalkadas6075
    @mohammedalkadas6075 2 ปีที่แล้ว

    many thanks bro ^_*

  • @nature_music_sport
    @nature_music_sport ปีที่แล้ว +1

    thaaaaanksss

  • @ZarakTekken8
    @ZarakTekken8 2 ปีที่แล้ว

    What if app kill?

  • @magnificentappdeveloper3071
    @magnificentappdeveloper3071 3 ปีที่แล้ว

    How to manage if client adds new data to database from web and on app we have old sync.

    • @SnippetCoder
      @SnippetCoder  3 ปีที่แล้ว

      There is way to achieve it, Send the push notification to the app, and send payload "app_update" check if push notification payload is "app_update" then clear the cache and it will read updated data from API?

    • @magnificentappdeveloper3071
      @magnificentappdeveloper3071 3 ปีที่แล้ว +1

      @@SnippetCoder I am very thankful for your kind and quick response.

  • @nezabarom1816
    @nezabarom1816 11 หลายเดือนก่อน

    where update?

  • @demodemo9429
    @demodemo9429 ปีที่แล้ว

    For complex modes it’s not working bro

  • @dolbysoundsofficial9323
    @dolbysoundsofficial9323 3 ปีที่แล้ว +3

    less code more productivity

  • @BDWATCHLEARN
    @BDWATCHLEARN 3 ปีที่แล้ว

    Woocommerce variations 🧐

  • @flutsnow
    @flutsnow ปีที่แล้ว

    👍

  • @AswanathCK
    @AswanathCK 2 ปีที่แล้ว

    Hello bro,
    Once I cache all the data, Then when the user restarts the app we need to call the api data right?(otherwise it will never update). So, will it be good to clear the cache in the main function?.

    • @SnippetCoder
      @SnippetCoder  2 ปีที่แล้ว +1

      Hello, Its all depends upon the requirement. If you wanna keep the data then no need to clear, else you can clear it as per your requirement.

    • @AswanathCK
      @AswanathCK 2 ปีที่แล้ว

      @@SnippetCoder Thank you brother for the reply.☺️👍 Keep going.