{
  "id": "flutter/typeerror-null-not-subtype-int",
  "signature": "type 'Null' is not a subtype of type 'int' in type cast",
  "signature_zh": "类型 'Null' 不是类型 'int' 的子类型，类型转换失败",
  "regex": "type 'Null' is not a subtype of type 'int' in type cast",
  "domain": "flutter",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "A null value was assigned or returned where a non-nullable int was expected, often due to missing null-safety handling in JSON parsing or API responses.",
  "root_cause_type": "generic",
  "root_cause_zh": "在期望非空 int 的地方分配或返回了 null 值，通常是由于 JSON 解析或 API 响应中缺少空安全处理。",
  "versions": [
    {
      "version": "Flutter 3.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Flutter 3.3",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Flutter 3.7",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Using 'as int' without null check",
      "why_fails": "If the value is null, the cast will throw the same error.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Ignoring null-safety and using 'dynamic' instead of 'int'",
      "why_fails": "Defeats the purpose of null safety and can lead to runtime type errors elsewhere.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Assuming the API will never return null for that field",
      "why_fails": "APIs can change or return null for missing fields; brittle assumption.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use null-safe access with a fallback value:\nint value = (json['field'] as int?) ?? 0;",
      "success_rate": 0.9,
      "how": "Use null-safe access with a fallback value:\nint value = (json['field'] as int?) ?? 0;",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a JSON parsing library like 'json_serializable' with nullable fields defined properly:\n@JsonKey(name: 'field', defaultValue: 0)\nint field;",
      "success_rate": 0.95,
      "how": "Use a JSON parsing library like 'json_serializable' with nullable fields defined properly:\n@JsonKey(name: 'field', defaultValue: 0)\nint field;",
      "condition": "",
      "sources": []
    },
    {
      "action": "Add explicit null checks before casting:\nif (json['field'] != null) {\n  int value = json['field'] as int;\n} else {\n  // handle null case\n}",
      "success_rate": 0.85,
      "how": "Add explicit null checks before casting:\nif (json['field'] != null) {\n  int value = json['field'] as int;\n} else {\n  // handle null case\n}",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Use null-safe access with a fallback value:\nint value = (json['field'] as int?) ?? 0;",
    "Use a JSON parsing library like 'json_serializable' with nullable fields defined properly:\n@JsonKey(name: 'field', defaultValue: 0)\nint field;",
    "Add explicit null checks before casting:\nif (json['field'] != null) {\n  int value = json['field'] as int;\n} else {\n  // handle null case\n}"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://dart.dev/null-safety",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.84,
  "fix_success_rate": 0.88,
  "resolvable": "true",
  "first_seen": "2023-05-12",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}