dateTimeFromIso8601String function

DateTime? dateTimeFromIso8601String(
  1. String? value
)

Converts an ISO 8601 string to a DateTime object.

Returns null if the provided value is null.

value The ISO 8601 string to convert. returns The DateTime object or null if the input is null.

Implementation

DateTime? dateTimeFromIso8601String(final String? value) => switch (value) {
  null => null,
  '' => null,
  _ => DateTime.tryParse(value),
};