Logging large strings from Flutter

前端 未结 8 1959
天涯浪人
天涯浪人 2020-12-17 07:50

I\'m trying to build a Flutter App and learning Dart in the process, but I\'m getting kind of frustrated when debugging. I have fetched a resource from an API and now I want

8条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-17 08:16

    Use this method

    JsonEncoder encoder = new JsonEncoder.withIndent('  ');
    String prettyprint = encoder.convert(yourJsonString);
    debugPrint(prettyprint);
    

    But it works only with JSON strings, I have not idea about how to do with "normal" strings. The first thing I think is to add manually a \n after every n characters, for now, while waiting for a stable fix!

提交回复
热议问题