title: Flutter - Save token in the response header in sharedpreference
body: <p>how to save token passed in response header in sharedpreference.im sharing code below:</p>
  <pre><code>Future&lt;DriverModel&gt; _handleLogin(Int country_code, Int phone, String password) async {
  var jsonData = null;
  SharedPreferences sharedPreferences = await SharedPreferences.getInstance();
  Map data = {
    'phone': {
      'country_code': country_code,
      'phone': phone,
    },
    'password': password,
  };
  var body = json.encode(data);
  final response = await http.post(
    AuthApi.login,
    headers: {&quot;Content-Type&quot;: &quot;application/json&quot;},
    body: body,
  );
  if (response.statusCode == 200) {
    print(response.headers.entries);
    
    return DriverModel.fromJson(jsonData);
  } else {
    return DriverModel.fromJson(jsonData);
  }
  </code></pre>
  <p>}</p>