[nnbd/corelib] Restore null check in DateTime._withValue constructor

The null check in DateTime._withValue is needed to be backwards
compatible with legacy code which might still call DateTime
constructors with isUtc == null.

Fixes co19_2/LibTest/core/DateTime/DateTime.fromMillisecondsSinceEpoch_A02_t01
failing test after unforking SDK.

Change-Id: I5394a25d0c6a5be41cad984f98e1cf56f400106e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/134869
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
This commit is contained in:
Alexander Markov 2020-02-11 15:38:51 +00:00 committed by commit-bot@chromium.org
parent c3f75f0ca9
commit 61b2d6a9a7
2 changed files with 3 additions and 3 deletions

View file

@ -393,9 +393,7 @@ class DateTime implements Comparable<DateTime> {
throw ArgumentError(
"DateTime is outside valid range: $millisecondsSinceEpoch");
}
if (isUtc == null) {
throw ArgumentError("'isUtc' flag may not be 'null'");
}
ArgumentError.checkNotNull(isUtc, "isUtc");
}
/**

View file

@ -392,6 +392,8 @@ class DateTime implements Comparable<DateTime> {
throw ArgumentError(
"DateTime is outside valid range: $millisecondsSinceEpoch");
}
// For backwards compatibility with legacy mode.
ArgumentError.checkNotNull(isUtc, "isUtc");
}
/**