flashcard flutter app RTDB to firestore transfer - flutter

so along with an exceptional app dev i have build a flashcard app that uses RTDB to store the progress of every card. i would like to transfer to firestore cloud, can anyone help me write a script for it?

There is no way to automatically convert an app that uses the Firebase Realtime Database to it using Cloud Firestore. While both are NoSQL databases, their data models are quite different - and there's no way to simply map the data or API calls from one to the other.

Related

Replicate information from Firebase to Device Storage

I have integrated Firebase (Firestore and Storage) inside my app (it is about QRs and chat with images). I have been checking the costs of the data transmission with Firebase and I think bill could skyrocket if my app is really successful.
I have been wondering lately about the posibility of storing in user's device the information that has been already downloaded from Firebase (chat messages, images, etc). Only not downloaded data will be requested to Firebase.
My idea is having the same data structure and content in both repositories, Firebase and local. Once the info has been requested to Firebase, replicate it locally and provide local information to the app. Historic information is never modified.
Has anybody handled two data repositories? Pros, cons?
I am working with Flutter.
Thank you.

Which database should I use for my flutter app using lots of images?

I want to build a flutter app which focuses on learning plant names with the help of a lot of pictures. In total there will be 600-800 pictures.
question: Do I store these pictures all in the app or in a database?
From what I read so far I guess the app would be too big if I store all these pictures in the app.
question: Which database should I use for storing such an amount of pictures?
I want to give the possibility to store a lection/course (containing 30-40 pictures) locally on the phone to be able to learn without internet connection.
question: Which database should I use for that?
Question #1: Do I store these pictures all in the app or in a
database?
You should not store all the images in your app. Use the Cloud Storage for Firebase service to store your pictures and download them to your app as desired.
Question #2: Which database should I use for storing such an amount of pictures?
You should use Cloud Storage for Firebase to store your pictures: "Cloud Storage for Firebase is built for app developers who need to store and serve user-generated content, such as photos or videos."
Question #3: I want to give the possibility to store a section/course (containing 30-40 pictures) locally on the phone to be
able to learn without internet connection. Which database should I use
for that?
You can save these pictures locally as explained here in the Firebase doc: "The writeToFile() method downloads a file directly to a local device. Use this if your users want to have access to the file while offline."
If in a database, get pic to many times, and much more than the free limit of database , we will prefer pic in app than in database.
But in app will never consider the cost, just keep the develop account. Maybe, a pic could compress down to 50kb each, and the app will not too big to download.
mongodb google-could amazon ... all database on the market can serve you.
above dbs are good. the more resourses on net, the better envirnment we like.

How I can save JSON Api on device and use it when the device is not connected to internet

I tiring to made app that get data(Images and titles) from a web site as json api and put this data in a ListView bulider,
but I want to save the data on device first to view it when the device isn't connected to the internet and I want the data who I save it , be different order
You can use the Shared Preferences Package to store a Map
on the device.
I recommend reading Data Persistence with Flutter in the Cookbook. This will show you how to tackle this.
You could use SQFLite if you are familiar with SQL or Hive if you prefer to stick with pure dart

Can I pre-cache data to work offline in mobile app using AppSync?

I am developing an Android and iOS app that could be used in areas that have a very poor or no data connection. It is a requirement for the app to be pre-loaded with all of the data so it will work even if the app never communicated with the server, but it also needs to be able to update and sync when a connection is made. Is it possible to manually populate the AppSync (Apollo) cache database with data on launch and query and mutate it later? The app also contains several search and filter queries. Our backend API is currently using GraphQL.
I have seen this question, Is it possible to build offline-first mobile apps using AWS AppSync?, but it is a little different that what I'm asking.
The recommendation would be to hydrate (read: pre-load with data) a local SQLite database after install. SQLite is what the 'local cache' uses to persist data on the device.
Refer to this github issue for a code example of how to do this:
https://github.com/awslabs/aws-mobile-appsync-sdk-js/issues/160

Firestone offline capabilities flutter

I know that Firestone will store data if the user is offline and I saw that there is a way to do this with native code, but is it possible to enable these offline capabilities in flutter itself?
Firebase firestore support full offline. I’m using it myself. So long as you’ve read the data at least once before going offline. If using firebase authentication - the custom option also works offline. Google sign-in does not.
The downside to firebases offline capabilities is that it’s only firestore (not counting the older firebase db) and not the other products like cloud storage.
So for example I’ve written an app and the document side of it is fully offline enabled however you can take photos in the app and I had the write the offline capabilities to sync this photos with firebase cloud storage myself.
(I basically just keep them in a pending folder and try to sync them when the device has connectivity.)