Repository: flutter
Issue: PR #89362 caused errors in the test logs
Labels: a: tests,c: regression,framework,f: material design,P3,team-design,triaged-design

There's two things to fix here:

- [x] Fixed these new exceptions.
  - Fixed by #91593
- [ ] Fixed the test harness to fail when there's exceptions like this.


Since https://github.com/flutter/flutter/pull/89362 landed the test logs have had output in them, like this:

```
$ flutter test test/material/bottom_sheet_test.dart
00:02 +0: Throw if enable drag without an animation controller                                              
══╡ EXCEPTION CAUGHT BY GESTURE ╞═══════════════════════════════════════════════════════════════════
The following assertion was thrown while handling a gesture:
'BottomSheet.animationController' can not be null when 'BottomSheet.enableDrag' is true. Use
'BottomSheet.createAnimationController' to create one, or provide another AnimationController.
'package:flutter/src/material/bottom_sheet.dart':
Failed assertion: line 219 pos 7: 'widget.enableDrag && widget.animationController != null'

Either the assertion indicates an error in the framework itself, or we should provide substantially
more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.md

When the exception was thrown, this was the stack:
#2      _BottomSheetState._handleDragUpdate (package:flutter/src/material/bottom_sheet.dart:219:7)
#3      DragGestureRecognizer._checkUpdate.<anonymous closure> (package:flutter/src/gestures/monodrag.dart:449:55)
#4      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:198:24)
#5      DragGestureRecognizer._checkUpdate (package:flutter/src/gestures/monodrag.dart:449:7)
#6      DragGestureRecognizer.handleEvent (package:flutter/src/gestures/monodrag.dart:298:9)
#7      PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:94:12)
#8      PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:139:9)
#9      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:525:8)
#10     PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:137:18)
#11     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:123:7)
#12     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:439:19)
#13     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:419:22)
#14     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:308:11)
#15     GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:374:7)
#16     GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:338:5)
#17     TestWidgetsFlutterBinding.handlePointerEventForSource.<anonymous closure> (package:flutter_test/src/binding.dart:495:42)
#18     TestWidgetsFlutterBinding.withPointerEventSource (package:flutter_test/src/binding.dart:505:11)
#19     TestWidgetsFlutterBinding.handlePointerEventForSource (package:flutter_test/src/binding.dart:495:5)
#20     WidgetTester.sendEventToBinding.<anonymous closure> (package:flutter_test/src/widget_tester.dart:806:15)
#21     WidgetTester.sendEventToBinding.<anonymous closure> (package:flutter_test/src/widget_tester.dart:805:39)
#24     TestAsyncUtils.guard (package:flutter_test/src/test_async_utils.dart:71:41)
#25     WidgetTester.sendEventToBinding (package:flutter_test/src/widget_tester.dart:805:27)
#26     TestGesture.moveTo.<anonymous closure> (package:flutter_test/src/test_pointer.dart:383:27)
#29     TestAsyncUtils.guard (package:flutter_test/src/test_async_utils.dart:71:41)
#30     TestGesture.moveTo (package:flutter_test/src/test_pointer.dart:381:27)
#31     TestGesture.moveBy (package:flutter_test/src/test_pointer.dart:373:12)
#32     WidgetController.dragFrom.<anonymous closure> (package:flutter_test/src/controller.dart:615:27)
<asynchronous suspension>
<asynchronous suspension>
(elided 7 frames from class _AssertionError, dart:async, and package:stack_trace)

Handler: "onUpdate"
Recognizer:
  VerticalDragGestureRecognizer#11fb5
════════════════════════════════════════════════════════════════════════════════════════════════════
══╡ EXCEPTION CAUGHT BY GESTURE ╞═══════════════════════════════════════════════════════════════════
The following assertion was thrown while handling a gesture:
'BottomSheet.animationController' can not be null when 'BottomSheet.enableDrag' is true. Use
'BottomSheet.createAnimationController' to create one, or provide another AnimationController.
'package:flutter/src/material/bottom_sheet.dart':
Failed assertion: line 219 pos 7: 'widget.enableDrag && widget.animationController != null'

Either the assertion indicates an error in the framework itself, or we should provide substantially
more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.md

When the exception was thrown, this was the stack:
#2      _BottomSheetState._handleDragUpdate (package:flutter/src/material/bottom_sheet.dart:219:7)
#3      DragGestureRecognizer._checkUpdate.<anonymous closure> (package:flutter/src/gestures/monodrag.dart:449:55)
#4      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:198:24)
#5      DragGestureRecognizer._checkUpdate (package:flutter/src/gestures/monodrag.dart:449:7)
#6      DragGestureRecognizer.handleEvent (package:flutter/src/gestures/monodrag.dart:298:9)
#7      PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:94:12)
#8      PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:139:9)
#9      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:525:8)
#10     PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:137:18)
#11     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:123:7)
#12     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:439:19)
#13     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:419:22)
#14     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:308:11)
#15     GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:374:7)
#16     GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:338:5)
#17     TestWidgetsFlutterBinding.handlePointerEventForSource.<anonymous closure> (package:flutter_test/src/binding.dart:495:42)
#18     TestWidgetsFlutterBinding.withPointerEventSource (package:flutter_test/src/binding.dart:505:11)
#19     TestWidgetsFlutterBinding.handlePointerEventForSource (package:flutter_test/src/binding.dart:495:5)
#20     WidgetTester.sendEventToBinding.<anonymous closure> (package:flutter_test/src/widget_tester.dart:806:15)
#21     WidgetTester.sendEventToBinding.<anonymous closure> (package:flutter_test/src/widget_tester.dart:805:39)
#24     TestAsyncUtils.guard (package:flutter_test/src/test_async_utils.dart:71:41)
#25     WidgetTester.sendEventToBinding (package:flutter_test/src/widget_tester.dart:805:27)
#26     TestGesture.moveTo.<anonymous closure> (package:flutter_test/src/test_pointer.dart:383:27)
#29     TestAsyncUtils.guard (package:flutter_test/src/test_async_utils.dart:71:41)
#30     TestGesture.moveTo (package:flutter_test/src/test_pointer.dart:381:27)
#31     TestGesture.moveBy (package:flutter_test/src/test_pointer.dart:373:12)
#32     WidgetController.dragFrom.<anonymous closure> (package:flutter_test/src/controller.dart:618:29)
<asynchronous suspension>
<asynchronous suspension>
(elided 7 frames from class _AssertionError, dart:async, and package:stack_trace)

Handler: "onUpdate"
Recognizer:
  VerticalDragGestureRecognizer#11fb5
════════════════════════════════════════════════════════════════════════════════════════════════════
══╡ EXCEPTION CAUGHT BY GESTURE ╞═══════════════════════════════════════════════════════════════════
The following assertion was thrown while handling a gesture:
'BottomSheet.animationController' can not be null when 'BottomSheet.enableDrag' is true. Use
'BottomSheet.createAnimationController' to create one, or provide another AnimationController.
'package:flutter/src/material/bottom_sheet.dart':
Failed assertion: line 230 pos 7: 'widget.enableDrag && widget.animationController != null'

Either the assertion indicates an error in the framework itself, or we should provide substantially
more information in this error message to help you determine and fix the underlying cause.
In either case, please report this assertion by filing a bug on GitHub:
  https://github.com/flutter/flutter/issues/new?template=2_bug.md

When the exception was thrown, this was the stack:
#2      _BottomSheetState._handleDragEnd (package:flutter/src/material/bottom_sheet.dart:230:7)
#3      DragGestureRecognizer._checkEnd.<anonymous closure> (package:flutter/src/gestures/monodrag.dart:485:47)
#4      GestureRecognizer.invokeCallback (package:flutter/src/gestures/recognizer.dart:198:24)
#5      DragGestureRecognizer._checkEnd (package:flutter/src/gestures/monodrag.dart:485:5)
#6      DragGestureRecognizer.didStopTrackingLastPointer (package:flutter/src/gestures/monodrag.dart:393:9)
#7      OneSequenceGestureRecognizer.stopTrackingPointer (package:flutter/src/gestures/recognizer.dart:392:9)
#8      DragGestureRecognizer._giveUpPointer (package:flutter/src/gestures/monodrag.dart:402:5)
#9      DragGestureRecognizer.handleEvent (package:flutter/src/gestures/monodrag.dart:321:7)
#10     PointerRouter._dispatch (package:flutter/src/gestures/pointer_router.dart:94:12)
#11     PointerRouter._dispatchEventToRoutes.<anonymous closure> (package:flutter/src/gestures/pointer_router.dart:139:9)
#12     _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:525:8)
#13     PointerRouter._dispatchEventToRoutes (package:flutter/src/gestures/pointer_router.dart:137:18)
#14     PointerRouter.route (package:flutter/src/gestures/pointer_router.dart:123:7)
#15     GestureBinding.handleEvent (package:flutter/src/gestures/binding.dart:439:19)
#16     GestureBinding.dispatchEvent (package:flutter/src/gestures/binding.dart:419:22)
#17     RendererBinding.dispatchEvent (package:flutter/src/rendering/binding.dart:308:11)
#18     GestureBinding._handlePointerEventImmediately (package:flutter/src/gestures/binding.dart:374:7)
#19     GestureBinding.handlePointerEvent (package:flutter/src/gestures/binding.dart:338:5)
#20     TestWidgetsFlutterBinding.handlePointerEventForSource.<anonymous closure> (package:flutter_test/src/binding.dart:495:42)
#21     TestWidgetsFlutterBinding.withPointerEventSource (package:flutter_test/src/binding.dart:505:11)
#22     TestWidgetsFlutterBinding.handlePointerEventForSource (package:flutter_test/src/binding.dart:495:5)
#23     WidgetTester.sendEventToBinding.<anonymous closure> (package:flutter_test/src/widget_tester.dart:806:15)
#24     WidgetTester.sendEventToBinding.<anonymous closure> (package:flutter_test/src/widget_tester.dart:805:39)
#27     TestAsyncUtils.guard (package:flutter_test/src/test_async_utils.dart:71:41)
#28     WidgetTester.sendEventToBinding (package:flutter_test/src/widget_tester.dart:805:27)
#29     TestGesture.up.<anonymous closure> (package:flutter_test/src/test_pointer.dart:394:24)
#30     TestGesture.up.<anonymous closure> (package:flutter_test/src/test_pointer.dart:392:39)
#33     TestAsyncUtils.guard (package:flutter_test/src/test_async_utils.dart:71:41)
#34     TestGesture.up (package:flutter_test/src/test_pointer.dart:392:27)
#35     WidgetController.dragFrom.<anonymous closure> (package:flutter_test/src/controller.dart:635:21)
<asynchronous suspension>
<asynchronous suspension>
(elided 7 frames from class _AssertionError, dart:async, and package:stack_trace)

Handler: "onEnd"
Recognizer:
  VerticalDragGestureRecognizer#11fb5
════════════════════════════════════════════════════════════════════════════════════════════════════
00:03 +32: All tests passed!                                                                                
$
```

cc @xu-baolin @Piinks