title: How to delete data using http.delete Flutter
body: <p>I'm Learning CRUD( Create,Read,Update,Delete) using rest api , I'm already GET &amp; POST data, How to implement "http.delete()" in Flutter ?</p>
  
  <p>I'm already Using this function, i can get ID for deleting data, but not deleting. </p>
  
  <pre><code>Future deleteMahasiswa(Map&lt;String, dynamic&gt; id) async {
      final response =
          await http.delete('${Urls.BASE_API_URL}/mahasiswa/delete?id=$id');
      return response.statusCode == 200;
    }
  
  class Urls {
    static const BASE_API_URL = 'http://192.168.43.159/wpu-rest-server/apii/';
    static const BASE_HOST ='http://192.168.43.159/';
  }
  </code></pre>
  
  <p>And This for View</p>
  
  <pre><code>void _deleteAction() async {
       final post = {
        "id": widget.id
      };
      bool result = await api.deleteMahasiswa(post);
      if (result) {
        _showSnackBar(context, 'Hapus ${widget.nama} Berhasil');
        debugPrint(widget.id);
      }
      else{
        _showSnackBar(context, 'Fail');
        debugPrint(widget.id);
  
        return null;
  
      }
      _refreshList();
    }
  </code></pre>
  
  <p>this for button onpressed</p>
  
  <pre><code>onPressed: () {
  _deleteAction();
  },
  </code></pre>
  
  <p>I'm mistake something ?</p>
  
  <p><strong>Update</strong>
  I'm Try change my code like this :</p>
  
  <pre><code>Future deletedDeleted(String id) async {
      final _authority = "${Urls.BASE_API_HOST}";
      final _path = "/wpu-rest-server/apii/mahasiswa/delete/$id";
      // final _params = { "id" : id };
      final httpClient = HttpClient();
      final _uri = Uri.http(_authority, _path);
      final request = await httpClient.deleteUrl(_uri);
      request.headers.set('content-type', 'application/json');
      final response = await request.close();
      final responseBody = await response.transform(utf8.decoder).join();
      debugPrint(responseBody.toString());
      debugPrint(_uri.toString());
      return responseBody;
    }
  </code></pre>
  
  <p>My Console show me correct URL , but have message ID Null.
  <a href="https://i.stack.imgur.com/Vbmvc.png" rel="nofollow noreferrer">enter image description here</a></p>