dateTimeConstructor property Null safety

_DateTimeConstructor dateTimeConstructor
read / write

Allows specifying a different way of creating a DateTime instance for testing.

There can be rare and erratic errors in DateTime creation in both JavaScript and the Dart VM, and this allows us to test ways of compensating for them.

Implementation

_DateTimeConstructor dateTimeConstructor = (int year, int month, int day,
    int hour24, int minute, int second, int fractionalSecond, bool utc) {
  if (utc) {
    return DateTime.utc(
        year, month, day, hour24, minute, second, fractionalSecond);
  } else {
    return DateTime(
        year, month, day, hour24, minute, second, fractionalSecond);
  }
};