Skip to content

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

@federico2390

Description

@federico2390

Hello,
I have put the json file on my shared hosting and when I try to run your example by changing the baseURL with the complete path of the json online, I receive the error on title but the "response.body" print correctly the json.
Why?

final baseUrl = "https://api.buuumit.com/d.json";

  Future<List<dynamic>> fetchElements() async {
    try {
      final response = await get(Uri.parse(baseUrl));
      print(jsonDecode(response.body));
      return jsonDecode(response.body) as List;
    } catch (e) {
      print(e);
      return [];
    }
  }

thx

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions