Repository navigation
Description
Steps to reproduce
- Open a modal bottom sheet holding a
DraggableScrollableSheetwithsnap: true. - Drag the sheet so it stops between snap sizes, and release. It starts snapping.
- While it snaps, touch the sheet and lift the finger without dragging.
Expected results
No assertion. The touch's hold on the scroll position ends when the finger lifts.
Actual results
'package:flutter/src/widgets/scrollable.dart': Failed assertion: line 907 pos 12: '_hold == null': is not true.
The assertion is in ScrollableState._handleDragCancel. A second touch before the snap ends fails the matching assertion in _handleDragDown (line 865). Only debug builds show it, because it is an assert.
From reading the source, the cause looks like this:
- The touch calls
position.hold(), which starts aHoldScrollActivity._DraggableScrollableSheetPosition.beginActivitystops the running snap, so the sheet rests between sizes. - Lifting the finger calls
_handleDragCanceland then_hold.cancel(), which callsgoBallistic(0). _shouldSnap()is true, sogoBallisticskipssuper.goBallistic. It calls_dragCancelCallback, which is null for a hold, and starts its ownAnimationControllerwithout callingbeginActivity.- The hold activity is not disposed, so
_disposeHolddoes not run before the assert.
_DraggableScrollableSheetPosition overrides drag to save the cancel callback, but it has no equivalent for hold. The same goBallistic code is on master.
Code sample
This is a test that fails on the expect:
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('a touch lifted while the sheet snaps', (tester) async {
tester.view
..devicePixelRatio = 1
..physicalSize = const Size(400, 800);
addTearDown(tester.view.reset);
await tester.pumpWidget(
const MaterialApp(home: Scaffold(body: SizedBox.expand())),
);
showModalBottomSheet<void>(
context: tester.element(find.byType(Scaffold)),
isScrollControlled: true,
builder: (_) => DraggableScrollableSheet(
expand: false,
initialChildSize: 2 / 3,
minChildSize: 1 / 3,
snap: true,
snapSizes: const [2 / 3],
builder: (_, controller) => SingleChildScrollView(
controller: controller,
child: Column(
children: [for (var i = 0; i < 40; i++) Text('Line $i')],
),
),
),
);
await tester.pumpAndSettle();
final line = find.text('Line 3');
final drag = await tester.startGesture(tester.getCenter(line));
await drag.moveBy(const Offset(0, -60));
await tester.pump();
await drag.moveBy(const Offset(0, -60));
await tester.pump();
await drag.up();
await tester.pump();
await tester.pump(const Duration(milliseconds: 16));
final touch = await tester.startGesture(tester.getCenter(line));
await tester.pump();
await touch.up();
await tester.pump();
expect(tester.takeException(), isNull);
await tester.pumpAndSettle();
});
}The same sheet placed directly in a Scaffold body did not fail in my test. I did not look into why.
Screenshots or Video
Not applicable. There is no visible symptom beyond the assertion.
Logs
Top of the stack, from a debug build on a physical Android 13 device:
#0 ScrollableState._handleDragCancel (package:flutter/src/widgets/scrollable.dart:907)
#1 GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:362)
#2 DragGestureRecognizer._checkCancel (package:flutter/src/gestures/monodrag.dart:904)
#3 DragGestureRecognizer.didStopTrackingLastPointer (package:flutter/src/gestures/monodrag.dart:761)
#4 OneSequenceGestureRecognizer.stopTrackingPointer (package:flutter/src/gestures/recognizer.dart:556)
#5 DragGestureRecognizer._giveUpPointer (package:flutter/src/gestures/monodrag.dart:773)
#6 DragGestureRecognizer.handleEvent (package:flutter/src/gestures/monodrag.dart:725)
Flutter Doctor output
flutter --version:
Flutter 3.47.7 • channel stable •
Framework • revision abaf9c5237 (3 weeks ago) • 2026-10-08 09:51:21 -0700
Engine • hash d8a2d6c768c334d53e16277f837970ffa1e2de81 (revision deb287481e) (24 days ago) • 2026-10-07 17:09:12.000Z
Tools • Dart 3.13.5 • DevTools 2.60.0
Activity
suryaKommana2662 commentedon Nov 2, 2026
@sehangel Thanks for the report. I was able to reproduce this issue locally using the provided test case. Routing to team-framework for further investigation.
Result: The test fails with the following assertion:
This appears related to #172174, as both involve the _hold == null assertion. However, #172174 involves interrupting a scroll in a
PageViewandSingleChildScrollView, whereas this issue occurs when a touch is lifted during aDraggableScrollableSheetsnap animation. Therefore, I'm keeping this as a separate issue rather than marking it as a duplicate.Flutter Doctor Output
[framework] Fix DraggableScrollableSheet '_hold == null' assertion wh…