36386

What is the best way to store data from Firebase to SQLite or offline in flutter?

<h3>Question</h3>

In my app when user is offline, I want data to store in local db and then sync data with firebase.


<h3>Answer1:</h3>

Both FireStore and Realtime Database have offline persistence.

Firestore :

Firestore.instance.settings(persistenceEnabled: true)

In the case of Firebase Realtime database, you don't need anything specific to set-up. Offline connectivity is automatic. So, the following line does the trick :

databaseReference.child(dbKey).set(data);

来源:https://stackoverflow.com/questions/61315478/what-is-the-best-way-to-store-data-from-firebase-to-sqlite-or-offline-in-flutter

Recommend

  • What is the best way to store data from Firebase to SQLite or offline in flutter?
  • iisnode not able to access file present in network file path
  • Why is a GOTO loop much slower than a FOR loop and depends additionally on power supply?
  • Retrieving data from firebase database: code didn't go into the completion block or an error bl
  • js,html,jquery 点击运行jquery 函数
  • Stop listening to snapshot updates in cloud firestore in flutter
  • Restriction of C standard I/O and why we can't use C standard I/O with sockets
  • Get the last element of a vector and push it to the same vector
  • Overriding a Java Method
  • knownhosts for Ant scp and sshexec tasks
  • Strange result of MPI_AllReduce for 16 byte real
  • react - how do I get the size of a component child elements and reposition them
  • json_encode dropping array_values key?
  • Hotkeys creation for java swing form
  • Download CSV File by posting JSON data in ASP.NET MVC
  • Why am I getting an Argument exception when creating event handler dynamically?
  • Swift manually rotate view controller
  • .Net core Hosted Services guaranteed to complete
  • opencv deskewing a contour
  • How to define a custom accuracy in Keras to ignore samples with a particular gold label?
  • What are advantages/disadvantages of using Selenium for Java vs .NET applications?
  • How to load dynamic images in custom ListView
  • Delphi Prism getting Unknown Identifier “DllImport” error
  • What is the difference between dynamically creating a script tag and statically embed a script tag?
  • r - input value by user to dataframe via shiny
  • Functions by reference or by variable, which to use when?
  • Why my AngularJS async test in Jasmine 1.3.x is not working?
  • Capture SIGFPE from SIMD instruction
  • Using Service Component Runtime
  • Jersey serializes character value to ASCII equivalent numeric string
  • How do I use TagLib-Sharp to write custom (PRIV) ID3 frames?
  • CAS 4 - Not able to retrieve the LDAP groups after successful authentication