Flutterflow handles Firestore timestamps correctly when the data is fetched from Firestore with the usual call action. However, if you get that same data as JSON from an API call, and then try to convert the JSON to a custom data type with a DateTime field, the action fails.
The problem seems to be the way Firestore timestamps are formatted; they can't be directly converted to DateTime objects. Flutterflow accounts for this in Firestore calls, but not in 'To Data Type' conversions.
I ended up creating a custom action that looks for the fields in my data that can contain a timestamp, separates them from the JSON, and converts them to DateTime objects that are temporarily stored in app state. Here's the code for the DateTime conversion if this thread is found by anyone struggling with the same issue.
DateTime? parseFirestoreTimestamp(Map<String, dynamic> timestamp) {
int seconds = timestamp['_seconds'];
int nanoseconds = timestamp['_nanoseconds'];
DateTime dateTime =
DateTime.fromMillisecondsSinceEpoch(seconds * 1000, isUtc: true)
.add(Duration(microseconds: nanoseconds ~/ 1000));
return dateTime;
}