# 未处理的异常：IsolateSpawnException: 反序列化消息失败：类型'List<dynamic>'不是类型'List<String>'的子类型

- **ID:** `flutter/deserialize-list-subtype-error`
- **领域:** flutter
- **类别:** type_error
- **验证级别:** ai_generated
- **修复率:** 92%

## 根因

在生成隔离时，发送的消息包含没有显式类型信息的List，而接收隔离期望一个类型化列表（例如`List<String>`），导致反序列化期间的类型转换失败。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| Flutter 3.10.0 | active | — | — |
| Flutter 3.16.0 | active | — | — |
| Flutter 3.22.0 | active | — | — |

## 解决方案

1. ```
   Explicitly cast the list to the expected type before sending: `isolate.send(list.cast<String>())`.
   ```
2. ```
   Define the list with explicit type annotations: `List<String> myList = ['a', 'b'];` and then send it.
   ```
3. ```
   Use a custom class to wrap the data and ensure proper serialization: `class MyData { final List<String> items; MyData(this.items); }`.
   ```

## 无效尝试

- **** — This only creates a new List<dynamic>; the receiving side still needs a typed list. (65% 失败率)
- **** — While this works, it adds overhead and is unnecessary; the proper fix is to type the list correctly. (50% 失败率)
- **** — This avoids the immediate error but may cause other type issues later. (70% 失败率)
