toDurationOrNull property

Duration? get toDurationOrNull

Parses "SS", "MM:SS", or "HH:MM:SS" into a Duration, returns null on failure.

Implementation

Duration? get toDurationOrNull {
  try {
    return toDuration();
  } on FormatException {
    return null;
  }
}