compare to null with == (#21944)

* compare to null with ==

* address review comments
This commit is contained in:
Alexandre Ardhuin 2018-10-01 21:22:51 +02:00 committed by GitHub
parent 224f91e386
commit 48fb726b01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View File

@ -83,11 +83,10 @@ class BoxDecoration extends Decoration {
this.backgroundBlendMode,
this.shape = BoxShape.rectangle,
}) : assert(shape != null),
// TODO(mattcarroll): Use "backgroundBlendMode == null" when https://github.com/dart-lang/sdk/issues/34180 is in.
assert(
identical(backgroundBlendMode, null) || color != null || gradient != null,
backgroundBlendMode == null || color != null || gradient != null,
'backgroundBlendMode applies to BoxDecoration\'s background color or '
'gradient, but no color or gradient were provided.'
'gradient, but no color or gradient was provided.'
);
@override

View File

@ -246,9 +246,7 @@ class TextStyle extends Diagnosticable {
String package,
}) : fontFamily = package == null ? fontFamily : 'packages/$package/$fontFamily',
assert(inherit != null),
// TODO(dnfield): once https://github.com/dart-lang/sdk/issues/33408 is finished, this can be replaced with
// assert(color == null || foreground == null, _kColorForegroundWarning);
assert(identical(color, null) || identical(foreground, null), _kColorForegroundWarning);
assert(color == null || foreground == null, _kColorForegroundWarning);
/// Whether null values are replaced with their value in an ancestor text