getDateTime method

DateTime? getDateTime(
  1. String key
)

Gets a DateTime from an ISO 8601 string or Unix timestamp.

Implementation

DateTime? getDateTime(String key) {
  final value = this[key];
  if (value is String) {
    return DateTime.tryParse(value);
  }
  if (value is int) {
    return DateTime.fromMillisecondsSinceEpoch(value * 1000);
  }
  return null;
}