The concept of my app is a basic survey collector excel sheet with 500 input fields/check boxes for each company registered, divided into 5 sections/screens on the mobile (each with 100 input fields). Every screen has a save button. Upon clicking the save button, the data should be saved in sqlite (offline/local db) and live server as well. And if the internet connection is unstable or not available only the data should be saved in local db. Till this I am done. My question is that when the internet is available how will I sync the saved data which is in my local db? And how will I maintain the flag which will indicate which screens are synced?
For instance I am shown a list of companies and I select one among them and fill 2 of it's screens online and rest 3 offline. Then I click another company and save it's random 2 screens offline as well. The internet is available then. Now how will I sync my those 2 and first 3 screens?
CodePudding user response:
What you are asking is all about designing your local database. If you are sending data to your server for each screen separately, You can have a new column dedicated for the synced_flag.
Screen1 => true
Screen2 => false
If you want to track your internet connection in real-time, You can use the NetInfo package for this kind of thing.