userCreationDateFromJson function

DateTime? userCreationDateFromJson(
  1. Map? json
)

Converts a Firestore map to DateTime object. Used for user creation date. The date is in the format of "Thu, 29 Sep 2022 10:44:56 GMT"

Implementation

DateTime? userCreationDateFromJson(Map? json) {
  final dateFormat = DateFormat("EEE, dd MMM yyyy HH:mm:ss 'GMT'", "en_US");
  return dateFormat.parse(
    json?['creationTime'] as String? ??
        dateFormat.format(DateTime.now().toUtc()),
  );
}