How to log data to the Flutter console?

前端 未结 5 1128
攒了一身酷
攒了一身酷 2020-12-23 19:01

I am a beginner and using IntelliJ IDEA, and I wanted to log data to the console?

I tried print() and printDebug(), but none of my data were

5条回答
  •  礼貌的吻别
    2020-12-23 19:29

    log() from 'dart:developer'

    • It doesn't seem to have a max length limits like print() or debugPrint().

    • So it comes helpful when you want to log the whole API response.

    • And also helps in dart dev tools to show formatted logging.

    import 'dart:developer';  //(auto import will do this even)
    //example for api logging
      log("${response?.statusCode} :  ${response?.request?.path}",
              name: "Response", error: response.data);
    

提交回复
热议问题