title: TypeError (type 'User' is not a subtype of type 'FutureOr<Either<Error, User>>'), even with same type return value
body: <p>how to properly assign a return value to a <code>Future&lt;Either&lt;Error, User&gt;&gt;&gt;</code>? Because I alway getting: 
  <code>_TypeError (type 'User' is not a subtype of type 'FutureOr&lt;Either&lt;Error, User&gt;&gt;') as required by the closure's context'</code>
  I even gave a <strong>same type</strong> return value.</p>
  
  <pre class="lang-dart prettyprint-override"><code>import 'package:dartz/dartz.dart';
  
  class APIPenggunaHelper {
    final api=APIPengguna();
    Future&lt;Either&lt;Error,User&gt;&gt; ambildatauser() async{
      final hasilapi=await api.ambilSemuaData();
      return hasilapi.fold((l){
        // handling error
        if(hasilapi.length()&lt;1) return Left(MasalahDataKosong());
        return Left(Masalah400());
      }, (r){
        // handling result
        print(r.toString());
        final user_= User.fromJson(jsonDecode(r));
        return Right(user);
      });
    }
  }
  </code></pre>
  
  <p>The code above should return <strong>user</strong> which is a <code>User</code> <em>class</em> as it should be, but it shows <code>subtype error</code> which I mention above.</p>
  
  <p>This is the output from <code>print(r.toString())</code></p>
  
  <pre><code>[
    {
      "id": 1,
      "name": "Leanne Graham",
      "username": "Bret",
      "email": "Sincere@april.biz",
      "address": {
        "street": "Kulas Light",
        "suite": "Apt. 556",
        "city": "Gwenborough",
        "zipcode": "92998-3874",
        "geo": {
          "lat": "-37.3159",
          "lng": "81.1496"
        }
      },
      "phone": "1-770-736-8031 x56442",
      "website": "hildegard.org",
      "company": {
        "name": "Romaguera-Crona",
        "catchPhrase": "Multi-layered client-server neural-net",
        "bs": "harness real-time e-markets"
      }
    },
    .
    .
    .
    ]
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>API.dart</p>
  
  <pre class="lang-dart prettyprint-override"><code>class APIPengguna {
    final String linkpengguna='/users';
    Future&lt;Either&lt;Exception, dynamic&gt;&gt; ambilSemuaData() async{
      try {
        final mapbodi={
          "id":1,
          "username":"Bret"
        };
        // final uriapi=Uri.https('https://jsonplaceholder.typicode.com',linkpengguna);
        final uriapi='https://jsonplaceholder.typicode.com'+linkpengguna;
        Response respon=await get(uriapi);
        var status=respon.statusCode;
        var data=respon.body;
        // print('data: $data');
        if (status&lt;200 || status&gt;400) {
          throw new Exception('gagal ambil data');
        } else {
          return Right(data);     // data is a dynamic
        }
      } catch (e) {
        return (Left(Exception('gagal ambil data, eror: $e')));
      }
    }
  }
  </code></pre>
  
  <p><br/>
  list_user.dart</p>
  
  <pre class="lang-dart prettyprint-override"><code>import 'package:appsa/aplikasi/perpustakaan.dart';
  
  class DaftarUser{
    final List&lt;User&gt; pengguna;
  
    DaftarUser({this.pengguna});
  
    factory DaftarUser.fromJson(List&lt;dynamic&gt; jsonuser){
      List pengguna_=new List();
      pengguna_=jsonuser.map((p)=&gt;User.fromJson(p)).toList();
  
      return new DaftarUser(
        pengguna:pengguna_
      );
    }
  }
  </code></pre>
  
  <p><br/></p>
  
  <p>model_User.dart</p>
  
  <pre class="lang-dart prettyprint-override"><code>import 'dart:convert';
  
  class User {
    final int id;
    final String name;
    final String username;
    final String email;
    final Address address;
    final String phone;
    final String website;
    final Company company;
    User({
      this.id,
      this.name,
      this.username,
      this.email,
      this.address,
      this.phone,
      this.website,
      this.company,
    });
  
    Map&lt;String, dynamic&gt; toMap() {
      return {
        'id': id,
        'name': name,
        'username': username,
        'email': email,
        'address': address?.toMap(),
        'phone': phone,
        'website': website,
        'company': company?.toMap(),
      };
    }
  
    static User fromMap(Map&lt;String, dynamic&gt; map) {
      if (map == null) return null;
  
      return User(
        id: map['id']?.toInt(),
        name: map['name'],
        username: map['username'],
        email: map['email'],
        address: Address.fromMap(map['address']),
        phone: map['phone'],
        website: map['website'],
        company: Company.fromMap(map['company']),
      );
    }
  
    String toJson() =&gt; jsonEncode(toMap());
  
    static User fromJson(String source) =&gt; fromMap(jsonDecode(source));
  
    @override
    String toString() {
      return 'User(id: $id, name: $name, username: $username, email: $email, address: $address, phone: $phone, website: $website, company: $company)';
    }
  
  </code></pre>