toDateTime function

DateTime? toDateTime(
  1. dynamic value
)

Implementation

DateTime? toDateTime(value) {
  if (value == null) return null;
  if (value is String) return DateTime.parse(value);
  if (value is int) return DateTime.fromMillisecondsSinceEpoch(value);
  return null;
}