How can I write and read Flutter’s TimeOfDay value in Firestore?
TimeOfDay is a value representing a time during the day, independent of the date that day might fall on or the time zone.
Should I convert it to a string ("13:30")?
How can I write and read Flutter’s TimeOfDay value in Firestore?
TimeOfDay is a value representing a time during the day, independent of the date that day might fall on or the time zone.
Should I convert it to a string ("13:30")?
2
Answers
The best option that you have is to save the date and time as a Timestamp:
If you only need to use the time, then you can simply get it out by calling toDate. Inside the DateTime class you’ll find two useful properties hour and minute.
You can convert TimeOfDay to DateTime then to store DateTime.toIsoString..()