HTTP request in flutter

后端 未结 4 1515
-上瘾入骨i
-上瘾入骨i 2020-12-23 14:58

I am using Retrofit for Android. It is easy to retrieve and upload JSON via a REST based web service. Can we get any library which is equivalent to Retrofit for web services

4条回答
  •  礼貌的吻别
    2020-12-23 15:57

    Just simple use this plug and little code for GET http url

    add this plugin from here httppackage

     http: ^0.12.0+2
    

    USAGE

    final uri = Constants.BASE_URL + 'endpoint';
        final headers = {'Content-Type': 'application/x-www-form-urlencoded'};//if required
        Response getResponse = await get(uri, headers: headers);
        int statusCode = getResponse.statusCode;
        String responseBody = getResponse.body;
        print('response----' + responseBody);
    

提交回复
热议问题