From 5ccd4f34303b05d412d05b1588c31cb2c4deb966 Mon Sep 17 00:00:00 2001 From: Alexandre Ardhuin Date: Wed, 27 Nov 2019 21:28:45 +0100 Subject: [PATCH] implicit-casts:false in flutter/lib/src/physics (#45622) --- packages/flutter/lib/src/physics/clamped_simulation.dart | 4 ++-- packages/flutter/lib/src/physics/friction_simulation.dart | 4 ++-- packages/flutter/lib/src/physics/spring_simulation.dart | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/flutter/lib/src/physics/clamped_simulation.dart b/packages/flutter/lib/src/physics/clamped_simulation.dart index a6fae44ad9..5d4cdfefef 100644 --- a/packages/flutter/lib/src/physics/clamped_simulation.dart +++ b/packages/flutter/lib/src/physics/clamped_simulation.dart @@ -48,10 +48,10 @@ class ClampedSimulation extends Simulation { final double dxMax; @override - double x(double time) => simulation.x(time).clamp(xMin, xMax); + double x(double time) => simulation.x(time).clamp(xMin, xMax) as double; @override - double dx(double time) => simulation.dx(time).clamp(dxMin, dxMax); + double dx(double time) => simulation.dx(time).clamp(dxMin, dxMax) as double; @override bool isDone(double time) => simulation.isDone(time); diff --git a/packages/flutter/lib/src/physics/friction_simulation.dart b/packages/flutter/lib/src/physics/friction_simulation.dart index 43c626e38b..5413b0f64d 100644 --- a/packages/flutter/lib/src/physics/friction_simulation.dart +++ b/packages/flutter/lib/src/physics/friction_simulation.dart @@ -65,7 +65,7 @@ class FrictionSimulation extends Simulation { // Solving for D given x(time) is trickier. Algebra courtesy of Wolfram Alpha: // x1 = x0 + (v0 * D^((log(v1) - log(v0)) / log(D))) / log(D) - v0 / log(D), find D static double _dragFor(double startPosition, double endPosition, double startVelocity, double endVelocity) { - return math.pow(math.e, (startVelocity - endVelocity) / (startPosition - endPosition)); + return math.pow(math.e, (startVelocity - endVelocity) / (startPosition - endPosition)) as double; } @override @@ -116,7 +116,7 @@ class BoundedFrictionSimulation extends FrictionSimulation { @override double x(double time) { - return super.x(time).clamp(_minX, _maxX); + return super.x(time).clamp(_minX, _maxX) as double; } @override diff --git a/packages/flutter/lib/src/physics/spring_simulation.dart b/packages/flutter/lib/src/physics/spring_simulation.dart index 066d35cb26..c5ba928d24 100644 --- a/packages/flutter/lib/src/physics/spring_simulation.dart +++ b/packages/flutter/lib/src/physics/spring_simulation.dart @@ -196,7 +196,7 @@ class _CriticalSolution implements _SpringSolution { @override double dx(double time) { - final double power = math.pow(math.e, _r * time); + final double power = math.pow(math.e, _r * time) as double; return _r * (_c1 + _c2 * time) * power + _c2 * power; } @@ -266,13 +266,13 @@ class _UnderdampedSolution implements _SpringSolution { @override double x(double time) { - return math.pow(math.e, _r * time) * + return (math.pow(math.e, _r * time) as double) * (_c1 * math.cos(_w * time) + _c2 * math.sin(_w * time)); } @override double dx(double time) { - final double power = math.pow(math.e, _r * time); + final double power = math.pow(math.e, _r * time) as double; final double cosine = math.cos(_w * time); final double sine = math.sin(_w * time); return power * (_c2 * _w * cosine - _c1 * _w * sine) +