# type 'List<dynamic>' is not a subtype of type 'List<String>' in type cast

- **ID:** `flutter/invalid-runtime-type-cast`
- **Domain:** flutter
- **Category:** type_error
- **Verification:** ai_generated
- **Fix Rate:** 95%

## Root Cause

Casting a decoded JSON list directly to `List<String>` without explicit type checking; JSON decode returns `List<dynamic>`.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 2.17.0 | active | — | — |
| 3.0.0 | active | — | — |
| 3.13.0 | active | — | — |
| 3.22.0 | active | — | — |

## Workarounds

1. **Use `List<String>.from()` or `jsonDecode(data).cast<String>().toList()` to safely convert with type checking.** (95% success)
   ```
   Use `List<String>.from()` or `jsonDecode(data).cast<String>().toList()` to safely convert with type checking.
   ```
2. **Decode with explicit type using `jsonDecode` and then iterate to filter or convert each element.** (90% success)
   ```
   Decode with explicit type using `jsonDecode` and then iterate to filter or convert each element.
   ```
3. **Use a JSON serialization library like `json_serializable` with proper model classes to avoid raw casts.** (85% success)
   ```
   Use a JSON serialization library like `json_serializable` with proper model classes to avoid raw casts.
   ```

## Dead Ends

- **** — If any element is not a String, `cast()` throws a runtime error; does not handle mixed types. (30% fail)
- **** — Type cast fails at runtime; app crashes when the list is accessed. (50% fail)
- **** — Swallows the error but the list remains untyped; subsequent operations may fail silently. (20% fail)
