getAsDateTime method

DateTime getAsDateTime(
  1. String key, [
  2. DateTime? orElse
])

Get the set corresponding to key in the DateTime.

If key is not found, the set of orElse is returned.

Implementation

DateTime getAsDateTime(String key, [DateTime? orElse]) {
  if (!arg.containsKey(key)) {
    return orElse ?? DateTime.now();
  }
  final millisecondsSinceEpoch = arg[key] as int?;
  if (millisecondsSinceEpoch == null) {
    return orElse ?? DateTime.now();
  }
  return DateTime.fromMillisecondsSinceEpoch(millisecondsSinceEpoch);
}