toDuration method
Tries convert the inputString to a Duration. It assumes the
inputString format is HH:MM:SS.SSS. Throws ConvertStringToDurationEx
on error.
Implementation
Duration toDuration() {
if (inputString == null) {
throw const _StringIsNullEx();
}
try {
final duration = toDurationOrNull()!;
return duration;
} catch (_) {
throw const _InvalidInputStringFormatEx();
}
}