mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 10:10:22 +00:00
[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:
parent
c3f75f0ca9
commit
61b2d6a9a7
2 changed files with 3 additions and 3 deletions
|
@ -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");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue