{
  "id": "flutter/isolate-message-deserialization",
  "signature": "Unhandled exception: IsolateSpawnException: Failed to deserialize message: type 'List<dynamic>' is not a subtype of type 'List<int>' in type cast",
  "signature_zh": "未处理的异常: IsolateSpawnException: 反序列化消息失败: 类型 'List<dynamic>' 不是类型 'List<int>' 的子类型",
  "regex": "IsolateSpawnException: Failed to deserialize message: type 'List<dynamic>' is not a subtype of type 'List<\\w+>' in type cast",
  "domain": "flutter",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "When sending a message between isolates, the data must be serializable and have exact types; a List containing mixed types or untyped lists caused a type cast failure during deserialization.",
  "root_cause_type": "generic",
  "root_cause_zh": "在隔离区之间发送消息时，数据必须是可序列化的且具有精确类型；包含混合类型或未类型化列表的 List 在反序列化期间导致类型转换失败。",
  "versions": [
    {
      "version": "Flutter 3.13.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Flutter 3.22.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Dart 3.1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Use 'List<dynamic>' as the type for the message variable",
      "why_fails": "The isolate communication protocol requires concrete types; <dynamic> is not concrete and causes the same error when the receiver expects a specific type.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Wrap the message in a Map with string keys to bypass type checking",
      "why_fails": "Maps also require concrete type parameters; a Map<String, dynamic> still fails if the receiver expects Map<String, int>.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "Set '--no-verify-types' flag in the Dart VM",
      "why_fails": "This flag does not exist; type verification is inherent to the isolate protocol and cannot be disabled.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Explicitly cast the list to the expected type before sending. Example:\n  List<int> data = [1, 2, 3];\n  await isolate.spawn(workerFunction, data);\nIf data comes from a dynamic source, use 'List<int>.from(data)' to ensure type safety.",
      "success_rate": 0.85,
      "how": "Explicitly cast the list to the expected type before sending. Example:\n  List<int> data = [1, 2, 3];\n  await isolate.spawn(workerFunction, data);\nIf data comes from a dynamic source, use 'List<int>.from(data)' to ensure type safety.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a typed data class that implements 'toMap' and 'fromMap' for serialization. Example:\n  class MyMessage {\n    final List<int> values;\n    MyMessage(this.values);\n    Map<String, dynamic> toMap() => {'values': values};\n    factory MyMessage.fromMap(Map<String, dynamic> map) => MyMessage(List<int>.from(map['values']));\n  }\nThen send the map and deserialize in the isolate.",
      "success_rate": 0.8,
      "how": "Use a typed data class that implements 'toMap' and 'fromMap' for serialization. Example:\n  class MyMessage {\n    final List<int> values;\n    MyMessage(this.values);\n    Map<String, dynamic> toMap() => {'values': values};\n    factory MyMessage.fromMap(Map<String, dynamic> map) => MyMessage(List<int>.from(map['values']));\n  }\nThen send the map and deserialize in the isolate.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Ensure the list is created with a concrete type parameter, e.g., 'List<int>.empty(growable: true)' instead of '[]' which defaults to List<dynamic>.",
      "success_rate": 0.75,
      "how": "Ensure the list is created with a concrete type parameter, e.g., 'List<int>.empty(growable: true)' instead of '[]' which defaults to List<dynamic>.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "在发送前显式将列表转换为预期类型。示例：\n  List<int> data = [1, 2, 3];\n  await isolate.spawn(workerFunction, data);\n如果数据来自动态源，使用 'List<int>.from(data)' 确保类型安全。",
    "使用实现 'toMap' 和 'fromMap' 的类型化数据类进行序列化。示例：\n  class MyMessage {\n    final List<int> values;\n    MyMessage(this.values);\n    Map<String, dynamic> toMap() => {'values': values};\n    factory MyMessage.fromMap(Map<String, dynamic> map) => MyMessage(List<int>.from(map['values']));\n  }\n然后发送 map 并在隔离区中反序列化。",
    "确保使用具体类型参数创建列表，例如 'List<int>.empty(growable: true)' 而不是默认为 List<dynamic> 的 '[]'。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://api.flutter.dev/flutter/dart-isolate/Isolate/spawn.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.86,
  "fix_success_rate": 0.82,
  "resolvable": "true",
  "first_seen": "2023-10-18",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}