diff --git a/packages/flutter/lib/src/widgets/scrollable.dart b/packages/flutter/lib/src/widgets/scrollable.dart index 18c2d2abdc..c8044ef965 100644 --- a/packages/flutter/lib/src/widgets/scrollable.dart +++ b/packages/flutter/lib/src/widgets/scrollable.dart @@ -197,10 +197,13 @@ abstract class ScrollableState extends State { } Simulation _createFlingSimulation(double velocity) { - final double endVelocity = pixelToScrollOffset(kPixelScrollTolerance.velocity); - final double endDistance = pixelToScrollOffset(kPixelScrollTolerance.distance); - return scrollBehavior.createFlingScrollSimulation(scrollOffset, velocity) - ..tolerance = new Tolerance(velocity: endVelocity.abs(), distance: endDistance); + final Simulation simulation = scrollBehavior.createFlingScrollSimulation(scrollOffset, velocity); + if (simulation != null) { + final double endVelocity = pixelToScrollOffset(kPixelScrollTolerance.velocity); + final double endDistance = pixelToScrollOffset(kPixelScrollTolerance.distance); + simulation.tolerance = new Tolerance(velocity: endVelocity.abs(), distance: endDistance); + } + return simulation; } double snapScrollOffset(double value) {