getDateFromTimestamp function

DateTime? getDateFromTimestamp(
  1. dynamic timestamp
)

Implementation

DateTime? getDateFromTimestamp(dynamic timestamp) {
  if (timestamp is int) {
    return DateTime.fromMicrosecondsSinceEpoch(timestamp);
  } else if (timestamp is String) {
    return DateTime.parse(timestamp);
  } else {
    return null;
  }
}