{
  "id": "flutter/scrollcontroller-not-attached",
  "signature": "FlutterError: ScrollController not attached to any scroll views",
  "signature_zh": "FlutterError: ScrollController 未附加到任何滚动视图",
  "regex": "ScrollController not attached to any scroll views",
  "domain": "flutter",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "ScrollController is used (e.g., .position, .offset, .animateTo) after it has been detached from all Scrollable widgets, typically due to a disposed state or incorrect lifecycle management.",
  "root_cause_type": "generic",
  "root_cause_zh": "ScrollController 在从所有 Scrollable 小部件分离后被使用（例如 .position、.offset、.animateTo），通常是由于状态已释放或生命周期管理不当。",
  "versions": [
    {
      "version": "Flutter 3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Flutter 3.13",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Flutter 3.16",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Creates a new controller each rebuild, losing scroll position and causing memory leaks; the error persists if the old controller is still referenced.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Does not address the root cause; the controller remains detached and further calls will still throw, leading to silent failures and broken UX.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Global state causes conflicts when multiple scroll views share the same controller; detaching from one page breaks others.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Ensure ScrollController is created in initState and disposed in dispose, and only access its properties after the scroll view has built (e.g., using WidgetsBinding.instance.addPostFrameCallback).",
      "success_rate": 0.85,
      "how": "Ensure ScrollController is created in initState and disposed in dispose, and only access its properties after the scroll view has built (e.g., using WidgetsBinding.instance.addPostFrameCallback).",
      "condition": "",
      "sources": []
    },
    {
      "action": "Check hasClients before accessing controller properties to avoid the error condition.",
      "success_rate": 0.92,
      "how": "Check hasClients before accessing controller properties to avoid the error condition.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Ensure ScrollController is created in initState and disposed in dispose, and only access its properties after the scroll view has built (e.g., using WidgetsBinding.instance.addPostFrameCallback).",
    "Check hasClients before accessing controller properties to avoid the error condition."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://api.flutter.dev/flutter/widgets/ScrollController-class.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.88,
  "resolvable": "true",
  "first_seen": "2023-06-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}