dateTimeConstructor property

  1. @visibleForTesting
  2. @Deprecated('clients should not depend on this internal field')
_DateTimeConstructor dateTimeConstructor
getter/setter pair

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

@visibleForTesting
@Deprecated('clients should not depend on this internal field')
// ignore: library_private_types_in_public_api
_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);
  }
};