I have one function is to upload the excel file into the firebase cloud firestore collection. Before i insert the data , i should clear all the document in the cloud firestore collection first . Is there any function or method can clear all the collection or document in one shot ?
void _importData() async {
for (var table in data.tables.keys) {
for (var row in data.tables[table].rows) {
print("$row");
await databaseReference.collection("vehicles").add({
//row[i] = the column sequence in the excel
'Car_Make': row[3],
'Company': row[4],
'Holder_Type': row[2],
'Holder_Name': row[1],
'Vehicle_No': row[0],
}).then((value) => print("Upload Complete"));
}
}
}