parseToUtc static method

DateTime parseToUtc(
  1. Object value
)

Converts value to the DateTime object in UTC.

The value can be of type String or DateTime.

Implementation

static DateTime parseToUtc(final Object value) => switch (value) {
  DateTime() => value.toUtc(),
  String() => DateTime.parse(value).toUtc(),
  _ => throw FormatException('Unexpected type ${value.runtimeType}'),
};