title: how can i call get API using headers in flutter? any idea?
body: <p>i have auth_key for fetch list.</p>
  <p>i tried many times but auth_key did not get in second screen, due to i can not fetch data from internet
  I tested the API with JSON request headers in Postman and it seems to be working fine.</p>
  <p>this is the Response...
  {
  &quot;error&quot;: false,
  &quot;message&quot;: &quot;success&quot;,
  &quot;course_list&quot;: [
  {
  &quot;courseId&quot;: &quot;19&quot;,
  &quot;courseName&quot;: &quot;Verbs-01-def-prctice&quot;,
  &quot;price&quot;: &quot;0&quot;,
  &quot;sub_type&quot;: &quot;1&quot;,
  &quot;sku_id&quot;: &quot;15464&quot;,
  &quot;courseIcon&quot;: &quot;&quot;,
  &quot;type&quot;: &quot;0&quot;,
  &quot;paid&quot;: false
  },</p>
  <pre><code>    **Now on my Flutter application I am trying to do the same thing:  
  **
      
          
      import 'package:flutter/material.dart';
      import 'dart:async';
      import 'package:http/http.dart' as http;
      import 'dart:convert';
      
      import 'package:http/http.dart';
      
      class SecondScreen extends StatefulWidget {
        @override
        _SecondScreenState createState() =&gt; _SecondScreenState();
      }
      
      class _SecondScreenState extends State&lt;SecondScreen&gt; {
        String url = '';
        List data;
      
        @override
        void initState() {
          super.initState();
          this.getJsonData();//call method here
        }
      
        Future&lt;http.Request&gt; getJsonData() async {
          var response = await http
              .get(url, headers: {'auth_key': '7tJBAO3xwIF3UhfIwMYryL2Cqo1dpQ'});//this is my auth_key(token)
      
          print(response.body);
      
          setState(() {
            var convertDataToJson = json.decode(response.body);
            data = convertDataToJson['results'];
          });
        }
      
        @override
        Widget build(BuildContext context) {
          return Scaffold(
            appBar: AppBar(
              title: Text(&quot;Courses&quot;),
            ),
            body: new ListView.builder(
              itemCount: data == null ? 0 : data.length,
              itemBuilder: (BuildContext context, int index) {
                return Container(
                  child: Center(
                    child: Column(
                      crossAxisAlignment: CrossAxisAlignment.stretch,
                      children: &lt;Widget&gt;[
                        Card(
                          child: Container(
                            child: Text(data[index]['courseName']),
                            padding: EdgeInsets.all(20.0),
                          ),
                        )
                      ],
                    ),
                  ),
                );
              },
            ),
          );
        }
      }
  </code></pre>
  <p>after run this App...</p>
  <p>Xcode build done.                                           14.3s
  Installing and launching...
  Syncing files to device Samcom Tech’s iPhone...
  flutter:  {&quot;error&quot;:true,&quot;message&quot;:&quot;Sorry, Auth key is not defined&quot;}
  [enter image description here][1]</p>