parse method

  1. @override
DateTime parse(
  1. String value
)

Converts a source string value to the specific option value type. Must throw a FormatException with an appropriate message if the value cannot be parsed.

Implementation

@override
DateTime parse(final String value) {
  final result = _parseDateTimeOrDuration(value);
  if (result == null) {
    throw FormatException(
      'Invalid value: expected ISO date string (e.g., "2024-01-15T10:30:00Z") '
      'or duration string (e.g., "5m", "3h", "1d"). Value was: "$value"',
    );
  }
  return result;
}