簡體   English   中英

在 flutter 中顯示來自 API 響應的完整 json 數據

[英]Display the complete json data from API response in flutter

I'm getting the json data from the API call but its not displaying the complete data.There are a lot of properties to work with and creating the model would be difficult as it's my first time working on any API.So i wanted to use app.quicktype.io to parse the json data directly into dart code for which i need to get the complete json data.Right now only little bit of the json data is being displayed in the console.

代碼:

Future<void> getContacts() async {
    var client = http.Client();
    String contacts_url =
        'https://mylinkexample.com';
    String basicAuth =
        'Basic mykeyexampele';
    var response = await client.get(contacts_url,
        headers: <String, String>{'authorization': basicAuth});
    var jsonString = jsonDecode(response.body);
    print(response.statusCode);
    print(jsonString);
  }

用這個:

import 'dart:developer' as developer;

test() {
  developer.log(response.body);
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM