isDateMills function

bool isDateMills(
  1. String v, {
  2. bool isUtc = false,
})

checks if the input is a valid date to parse by DateTime.fromMillisecondsSinceEpoch factory

Implementation

bool isDateMills(String v, {bool isUtc = false}) {
  try {
    if (!(int.tryParse(v) != null)) return false;
    DateTime.fromMillisecondsSinceEpoch(
      int.tryParse(v) ?? -1,
      isUtc: isUtc,
    );
    return true;
  } catch (e) {
    return false;
  }
}