getDateTime static method
将字符串或者时间戳转化成DateTime
Implementation
static DateTime getDateTime({String? dateStr, int? milliseconds}) {
DateTime? dateTime;
if (dateStr != null) {
dateTime = DateTime.tryParse(dateStr);
return dateTime!;
}
if (milliseconds != null) {
dateTime = DateTime.fromMillisecondsSinceEpoch(milliseconds);
return dateTime;
}
return dateTime!;
}