I want to keep data as Array in firestore by using more than one textformfield in Flutter. How can I send this data as an array? (The number of data is unknown. It could be any number.)
final FirebaseFirestore _firebaseFirestore = FirebaseFirestore.instance;
class _RepairState extends State<Repair> {
String formattedDate = DateFormat('dd-MM-yyyy - kk:mm').format(DateTime.now());
Future createRepairLogs(String title, String email, String desc, String date) async {
await _firebaseFirestore.collection("Repair").doc().set({
'title': title,
'email': email,
'description':desc,
'dateTime': date,
});
}
title will be an array. I want to have more than one data entry in the title.
Thanks for supporting.
2
Answers
you can convert your array to json which return string like this
then you can obtained the array back by decoding the json
change String title to List title