# FlutterError: ScrollController not attached to any scroll views.

- **ID:** `flutter/scroll-controller-not-attached`
- **Domain:** flutter
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 88%

## Root Cause

ScrollController used after being disposed or before being attached to a Scrollable widget.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.10.0 | active | — | — |
| 3.13.0 | active | — | — |
| 3.16.0 | active | — | — |
| 3.22.0 | active | — | — |

## Workarounds

1. **Ensure ScrollController is created once (e.g., in initState) and disposed in dispose(). Use a StatefulWidget.** (85% success)
   ```
   Ensure ScrollController is created once (e.g., in initState) and disposed in dispose(). Use a StatefulWidget.
   ```
2. **Use ScrollController.keepScrollOffset() or check _controller.hasClients before accessing scroll position.** (75% success)
   ```
   Use ScrollController.keepScrollOffset() or check _controller.hasClients before accessing scroll position.
   ```
3. **Switch to ScrollableState or use NotificationListener<ScrollNotification> to avoid explicit controller management.** (70% success)
   ```
   Switch to ScrollableState or use NotificationListener<ScrollNotification> to avoid explicit controller management.
   ```

## Dead Ends

- **** — Disposing the controller before it's attached prevents any scrolling functionality. (45% fail)
- **** — Creates memory leaks and detached controllers that accumulate. (30% fail)
- **** — Does not fix the underlying lifecycle issue; scrolling will silently fail. (25% fail)
