asDateTime method

DateTime? asDateTime({
  1. DateTime? def,
})

Implementation

DateTime? asDateTime({DateTime? def}) {
  var value = this ?? def ?? null;
  if (value == null) {
    return DateTime.utc(1977);
  }
  var res = DateTime.tryParse(value.toString().trim());
  return res;
}