title: How to convert the type Future<List<T>> to <List<T>> in fultter?
body: <p>everyone! I was developing e-commerce flutter app with doofinder APIs.
  But I faced a thorny problem. I tried to get data from doofinder(it's just search service) API then present to screen. I added screen-shots.
  <a href="https://i.stack.imgur.com/kwuT6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kwuT6.png" alt="search screen on mobile emulator" /></a></p>
  <p><a href="https://i.stack.imgur.com/NCfv2.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NCfv2.png" alt="enter image description here" /></a></p>
  <p><a href="https://i.stack.imgur.com/NzccN.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NzccN.png" alt="enter image description here" /></a></p>
  <pre><code>Future&lt;List&lt;Product&gt;&gt; fetchProduct(query) async {
    var response = await http.get(
      Uri.parse(
          'https://eu1-search.doofinder.com/5/search?hashid=30a5f&amp;query=$query'),
      // Send authorization headers to the backend.
      headers: {'Authorization': 'c59dadc5d822ca2b134f170'},
    );
    if (response.statusCode == 200) {
      // If the server did return a 200 OK response,
      // then parse the JSON.
      print(jsonDecode(response.body)['results'].toList().runtimeType);
      return jsonDecode(response.body)['results'].toList().cast&lt;List&lt;Product&gt;&gt;();
    } else {
      // If the server did not return a 200 OK response,
      // then throw an exception.
      throw Exception('Failed to load album');
    }
  }
  </code></pre>
  <p><em><strong>then,</strong></em></p>
  <pre><code>              onChanged: (_) =&gt; EasyDebounce.debounce(
                  'tFMemberController',
                  const Duration(milliseconds: 800),
                  () {
                    isSearchStarted =
                        textController!.text.isNotEmpty &amp;&amp;
                            textController!.text.trim().length &gt; 0;
                    print('isSearchStarted $isSearchStarted');
                    if (isSearchStarted) {
                      print('${textController!.text.trim()}');
                      searchedProducts =
                          fetchProduct(textController!.text)
                              as List&lt;Product&gt;;
                      print(searchedProducts);
                    }
                    setState(() {});
                  },
                ),
  </code></pre>
  <p>And this is error log.</p>
  <pre><code>E/flutter ( 5295): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'Future&lt;List&lt;Product&gt;&gt;' is not a subtype of type 'List&lt;Product&gt;' in type cast
  E/flutter ( 5295): #0      _SearchPageState.build.&lt;anonymous closure&gt;.&lt;anonymous closure&gt; (package:s4s_mobileapp/search/page_search.dart:151:41)
  E/flutter ( 5295): #1      EasyDebounce.debounce.&lt;anonymous closure&gt; (package:easy_debounce/easy_debounce.dart:44:22)
  E/flutter ( 5295): #2      Timer._createTimer.&lt;anonymous closure&gt; (dart:async-patch/timer_patch.dart:18:15)
  E/flutter ( 5295): #3      _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
  E/flutter ( 5295): #4      _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
  E/flutter ( 5295): #5      _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:192:12)
  E/flutter ( 5295): 
  I/flutter ( 5295): List&lt;dynamic&gt;
  E/flutter ( 5295): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'CastList&lt;dynamic, List&lt;Product&gt;&gt;' is not a subtype of type 'FutureOr&lt;List&lt;Product&gt;&gt;'
  E/flutter ( 5295): #0      fetchProduct (package:s4s_mobileapp/search/page_search.dart:41:58)
  E/flutter ( 5295): &lt;asynchronous suspension&gt;
  E/flutter ( 5295): 
  </code></pre>
  <p>This makes me crazy.
  I want you to take a closer look at the pictures below and find a suitable solution please.</p>