dynamicToDateTime static method

DateTime? dynamicToDateTime(
  1. dynamic value
)

Implementation

static DateTime? dynamicToDateTime(dynamic value) {
  try {
    if (value is String) return DateTime.parse(value);
    if (value is int) return DateTime.fromMillisecondsSinceEpoch(value);
  } catch (_) {}
  return null;
}