use conditional assignment (#9252)
This commit is contained in:
committed by
GitHub
parent
3eb87830e9
commit
8bcf302e23
@@ -577,10 +577,8 @@ class BoxShadow {
|
||||
static List<BoxShadow> lerpList(List<BoxShadow> a, List<BoxShadow> b, double t) {
|
||||
if (a == null && b == null)
|
||||
return null;
|
||||
if (a == null)
|
||||
a = <BoxShadow>[];
|
||||
if (b == null)
|
||||
b = <BoxShadow>[];
|
||||
a ??= <BoxShadow>[];
|
||||
b ??= <BoxShadow>[];
|
||||
final List<BoxShadow> result = <BoxShadow>[];
|
||||
final int commonLength = math.min(a.length, b.length);
|
||||
for (int i = 0; i < commonLength; ++i)
|
||||
|
||||
@@ -1482,8 +1482,7 @@ abstract class RenderBox extends RenderObject {
|
||||
@mustCallSuper
|
||||
double getDistanceToActualBaseline(TextBaseline baseline) {
|
||||
assert(_debugDoingBaseline);
|
||||
if (_cachedBaselines == null)
|
||||
_cachedBaselines = <TextBaseline, double>{};
|
||||
_cachedBaselines ??= <TextBaseline, double>{};
|
||||
_cachedBaselines.putIfAbsent(baseline, () => computeDistanceToActualBaseline(baseline));
|
||||
return _cachedBaselines[baseline];
|
||||
}
|
||||
|
||||
@@ -203,8 +203,7 @@ class ContainerLayer extends Layer {
|
||||
if (_lastChild != null)
|
||||
_lastChild._nextSibling = child;
|
||||
_lastChild = child;
|
||||
if (_firstChild == null)
|
||||
_firstChild = child;
|
||||
_firstChild ??= child;
|
||||
}
|
||||
|
||||
void _remove(Layer child) {
|
||||
|
||||
@@ -2697,8 +2697,7 @@ abstract class ContainerRenderObjectMixin<ChildType extends RenderObject, Parent
|
||||
_firstChildParentData.previousSibling = child;
|
||||
}
|
||||
_firstChild = child;
|
||||
if (_lastChild == null)
|
||||
_lastChild = child;
|
||||
_lastChild ??= child;
|
||||
} else {
|
||||
assert(_firstChild != null);
|
||||
assert(_lastChild != null);
|
||||
|
||||
@@ -199,8 +199,7 @@ class Ticker {
|
||||
assert(scheduled);
|
||||
_animationId = null;
|
||||
|
||||
if (_startTime == null)
|
||||
_startTime = timeStamp;
|
||||
_startTime ??= timeStamp;
|
||||
|
||||
_onTick(timeStamp - _startTime);
|
||||
|
||||
|
||||
@@ -132,8 +132,7 @@ class FocusScopeNode extends Object with TreeDiagnosticsMixin {
|
||||
if (_firstChild != null)
|
||||
_firstChild._previousSibling = child;
|
||||
_firstChild = child;
|
||||
if (_lastChild == null)
|
||||
_lastChild = child;
|
||||
_lastChild ??= child;
|
||||
child._updateManager(_manager);
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,7 @@ class TestGestureFlutterBinding extends BindingBase with GestureBinding {
|
||||
TestGestureFlutterBinding _binding = new TestGestureFlutterBinding();
|
||||
|
||||
void ensureTestGestureBinding() {
|
||||
if (_binding == null)
|
||||
_binding = new TestGestureFlutterBinding();
|
||||
_binding ??= new TestGestureFlutterBinding();
|
||||
assert(GestureBinding.instance != null);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user