type '_InternalLinkedHashMap' is not a subtype of type 'List<dynamic>' Flutter / Dart Origin: On your device OSI layer 7 · Application Last updated 4 Nov 2026

Dart: type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'List<dynamic>' in type cast

JSON decoded to a Map but your code expected a List (or the other way round).

Exact message you may see type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'List<dynamic>'type 'List<dynamic>' is not a subtype of type 'Map<String, dynamic>'type '_Map<String, dynamic>' is not a subtype of type 'List<dynamic>' in type castis not a subtype of type 'List<dynamic>'type 'String' is not a subtype of type 'int' of 'index'
Seen on: Flutter

Meaning

jsonDecode returns a Map for {…} and a List for […]. APIs often wrap lists in an object ({"data": […]}), or return an error object on failure. Print response.body, then read the right key before casting.

Common causes

  • Response is an object with a wrapper key, not a bare array
  • Error JSON returned instead of the list
  • Pagination envelope (items, results)
  • Casting as List on a Map
  • Mismatched model for single vs list endpoint

⚡ Quick fix

  1. Log response.body first
  2. Read the wrapper key: jsonDecode(body)['data'] as List
  3. Check response.statusCode before decoding

Detailed fix by platform

Dart

  1. final decoded = jsonDecode(body); final list = decoded is List ? decoded : decoded['items'] as List;

How to diagnose

  1. Body — Object or array?
  2. Status — 200?
  3. Key — Wrapper name?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: On your device. Errors that are often confused with or caused by this one (click to open):

Bad state: No element — Dart: Bad state: No element — .first, .last or .single on an empty list (Flutter / Dart)Bad state: No elementError: Couldn't resolve the package — Dart: Error: Couldn't resolve the package 'x' in 'package:x/x.dart' (Flutter / Dart)Error: Couldn't resol…FormatException: Unexpected character — Dart: FormatException: Unexpected character (at character 1) <!DOCTYPE html> — jsonDecode of an HTML page (Flutter / Dart)FormatException: Unex…Illegal argument in isolate message: object is unsendable — Dart: Invalid argument(s): Illegal argument in isolate message: object is unsendable - Library:'dart:async' Class: _Future@4048458 (Flutter / Dart)Illegal argument in i…The argument type can't be assigned to the parameter type — Dart: The argument type 'String?' can't be assigned to the parameter type 'String' (Flutter / Dart)The argument type can…The getter/method isn't defined for the type — Dart: The getter 'name' isn't defined for the type 'User' / The method 'foo' isn't defined for the class (Flutter / Dart)The getter/method isn…type 'Null' is not a subtype of type 'String' — Dart: type 'Null' is not a subtype of type 'String' in type cast (Flutter / Dart)type 'Null' is not a …type '_In…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.