Skip to content

Commit 60a1774

Browse files
committed
stream_colors [nfc]: Make StreamColorSwatches.lerp's other non-nullable
1 parent e57d1c6 commit 60a1774

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

lib/widgets/stream_colors.dart

+4-6
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,13 @@ abstract class StreamColorSwatches {
3333
/// This computation is cached on the instance
3434
/// in order to save work building [t]'s animation frame when there are
3535
/// multiple UI elements using the same [subscription.color].
36-
StreamColorSwatches lerp(StreamColorSwatches? other, double t) {
36+
StreamColorSwatches lerp(StreamColorSwatches other, double t) {
3737
// This short-circuit helps when [a] and [b]
3838
// are both [StreamColorSwatches.light]
3939
// or both [StreamColorSwatches.dark].
4040
// Empirically, [lerp] is called even when the theme hasn't changed,
4141
// so this is an important optimization.
42-
if (identical(this, other)) {
43-
return this;
44-
}
42+
if (identical(this, other)) return this;
4543

4644
return _StreamColorSwatchesLerped(this, other, t);
4745
}
@@ -65,12 +63,12 @@ class _StreamColorSwatchesLerped extends StreamColorSwatches {
6563
_StreamColorSwatchesLerped(this.a, this.b, this.t);
6664

6765
final StreamColorSwatches a;
68-
final StreamColorSwatches? b;
66+
final StreamColorSwatches b;
6967
final double t;
7068

7169
@override
7270
StreamColorSwatch _computeForBaseColor(int base) =>
73-
StreamColorSwatch.lerp(a.forBaseColor(base), b?.forBaseColor(base), t)!;
71+
StreamColorSwatch.lerp(a.forBaseColor(base), b.forBaseColor(base), t)!;
7472
}
7573

7674

0 commit comments

Comments
 (0)