3

I made a local database using sqflite to save data locally and i need to send it to a firebase in need so far the function i used to get the data is:

Future<List> getNameAndPrice() async{
   Database db = await instance.database;
   var result = await db.rawQuery('SELECT  $columnName , $columnAmount FROM $table');
   return result.toList();
 }

the other function i use in the other page of flutter to get the data is:

 Future sendtofirebase() async {
  var orders = await dbHelper.getNameAndPrice();
  print(orders);
  }

so far the print is just to check the data i get and i get the data in this format:

I/flutter (21542): [{name: Regular burger, amount: 2}, {name: Cheese
burger, amount: 1}]

i just want to find a way to like fetch this data from the variable and then send it to the firebase database i've made firestore collectionreference and everything i just don't know how can i get the name alone and send it then send the amount of the item etc.. for each order (how to get each item individually and send it to the firebase db).

really looking forward for answers cause i've spent time looking and i am stuck there.. ps. i am still a beginner and i even don't know if i should use both sqflite and firebase other than just saving everything in the firebase itself.. thank you for reading.

Idris
  • 43
  • 5

0 Answers0