title: How to get the token for register api in flutter
body: <p>I am having the Url for Token generation,by using http post i am getting the token.now my problem was i have to use the generated token as header in register api(another api).</p>
  
  <pre><code>Future&lt;Map&lt;String, dynamic&gt;&gt; fetchPost() async {
    print('feg');
    final response = await http.post(
      '/rest_api/gettoken&amp;grant_type=client_credentials',
      headers: {HttpHeaders.authorizationHeader: "Basic token"},
    );
    final responseJson = json.decode(response.body);
    print("Result: ${response.body}");
    //return Post.fromJson(responseJson);
    return responseJson;
  }
  </code></pre>
  
  <p>here i am getting the token i want to use that token to register api</p>
  
  <pre><code>  Future&lt;Register&gt; fetchPost() async {
    print('feg');
    final response = await http.post(
      'your base url/rest/register/register',
      headers: { HttpHeaders.authorizationHeader: "Bearer token",
        HttpHeaders.contentTypeHeader: "application/json"},
    );
    var   responseJson = json.decode(response.body);
    print("Result: ${response.body}");
    return Register.fromJson(responseJson);
  }
  </code></pre>
  
  <p>this is the post method for register api,i want to use previously generated bearer token in above api headers.</p>