{
  "id": "flutter/type-error-json-parse-int",
  "signature": "type 'String' is not a subtype of type 'int' in type cast",
  "signature_zh": "类型 'String' 不是类型 'int' 的子类型，在类型转换中",
  "regex": "type 'String' is not a subtype of type 'int' in type cast",
  "domain": "flutter",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "A JSON value that is a string (e.g., '123') is being cast directly to int using 'as int' instead of parsing it with int.parse() or using a proper deserialization method.",
  "root_cause_type": "generic",
  "root_cause_zh": "JSON 值是一个字符串（例如 '123'），但直接使用 'as int' 将其转换为 int，而不是使用 int.parse() 或适当的反序列化方法。",
  "versions": [
    {
      "version": "flutter 3.13",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "flutter 3.22",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "dart 3.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "dart 3.5",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Using toString() on the value before casting: (json['id'].toString() as int)",
      "why_fails": "toString() returns a String, which cannot be cast to int; the error persists.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Wrapping in a try-catch without parsing and returning a default value",
      "why_fails": "The cast still fails; the catch block may mask the root cause and lead to silent data corruption.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Parse the string to int explicitly using int.parse() and handle FormatException for invalid input.",
      "success_rate": 0.95,
      "how": "Parse the string to int explicitly using int.parse() and handle FormatException for invalid input.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a safe JSON deserialization approach with a fromJson factory that checks the runtime type and converts accordingly.",
      "success_rate": 0.9,
      "how": "Use a safe JSON deserialization approach with a fromJson factory that checks the runtime type and converts accordingly.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "使用 int.parse() 显式将字符串解析为 int，并处理 FormatException 以应对无效输入。",
    "使用安全的 JSON 反序列化方法，使用 fromJson 工厂检查运行时类型并进行相应转换。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://dart.dev/language/type-system",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.9,
  "fix_success_rate": 0.93,
  "resolvable": "true",
  "first_seen": "2023-08-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}