tryToDateTime method

DateTime? tryToDateTime(
  1. TimeUnit unit, {
  2. bool isUtc = false,
})

Try to parse timestamp.

Implementation

DateTime? tryToDateTime(TimeUnit unit, {bool isUtc = false}) {
  try {
    return toDateTime(unit, isUtc: isUtc);
  } catch (e) {
    return null;
  }
}