title: Eroor : Type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'List<dynamic>' in type cast
body: <p>I am new to Flutter, I try to fetch data from my api on "10.0.2.2:8000/api/membres" but got error like type List dynamic is not a subtype of type 'List. 
  I'm following the example of flutter:  <a href="https://flutter.dev/docs/cookbook/networking/fetch-data#complete-example" rel="noreferrer">https://flutter.dev/docs/cookbook/networking/fetch-data#complete-example</a></p>
  
  <p>Please help me to follow a helpful tutorial and tell me how to fix this code.</p>
  
  <p>MyHomePage.dart</p>
  
  <pre><code>import 'package:flutter/material.dart';
  import 'dart:async';
  import 'package:http/http.dart' as http;
  import 'dart:convert';
  
  class MyHomePage extends StatefulWidget {
    const MyHomePage({Key key}) : super(key: key);
  
    @override
    _MyHomePageState createState() =&gt; _MyHomePageState();
  }
  
  class _MyHomePageState extends State&lt;MyHomePage&gt; {
  
    static const url = "10.0.2.2:8000/api/membres";
  
    Future&lt;List&lt;Map&lt;String, dynamic&gt;&gt;&gt; _future;
    @override
    void initState() {
      super.initState();
      _future = fetch();
    }
  
    Future&lt;List&lt;Map&lt;String, dynamic&gt;&gt;&gt; fetch() {
      return http
          .get("http://10.0.2.2:8000/api/membres")
          .then((response) {
            return response.statusCode == 200
                ? response.body
                : throw 'Error when getting data';
          })
          .then((body) =&gt; json.decode(body)) //
          .then((list) =&gt; (list as List).cast&lt;Map&lt;String, dynamic&gt;&gt;());
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          title: Text('Home'),
        ),
        body: RefreshIndicator(
          onRefresh: () async {
            _future = fetch();
            setState(() {});
            return _future;
            },
          child: FutureBuilder&lt;List&lt;Map&lt;String, dynamic&gt;&gt;&gt;(
            future: _future,
            builder: (context, snapshot) {
              if (snapshot.hasError) {
                return Center(
                  child: Container(
                    constraints: BoxConstraints.expand(),
                    child: SingleChildScrollView(
                      physics: AlwaysScrollableScrollPhysics(),
                      child: Text(snapshot.error.toString()),),),);}
              if (!snapshot.hasData) {
                return Center(
                  child: CircularProgressIndicator(),
                );}
              return ListView.builder(
                itemCount: snapshot.data.length,
                itemBuilder: (BuildContext context, int index) {
                  final item = snapshot.data[index];
                  return ListTile(
                    title: Text(item['nom']),
                    subtitle: Text(item['prenom']),
                  );
                },
              );
            },
          ),
        ),
      );
    }
  }
  </code></pre>
  
  <p>I tested the API with Postman and it works :</p>
  
  <p><a href="https://i.stack.imgur.com/PykIY.png" rel="noreferrer"><img src="https://i.stack.imgur.com/PykIY.png" alt="enter image description here"></a></p>
  
  <p>And this is the error : 
  <a href="https://i.stack.imgur.com/kH2rA.png" rel="noreferrer"><img src="https://i.stack.imgur.com/kH2rA.png" alt="enter image description here"></a></p>
  
  <p>In the emulator : </p>
  
  <p><a href="https://i.stack.imgur.com/UuFNX.png" rel="noreferrer"><img src="https://i.stack.imgur.com/UuFNX.png" alt="enter image description here"></a></p>