从Flutter记录大字符串 [英] Logging large strings from Flutter

查看:352
本文介绍了从Flutter记录大字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建Flutter应用并在此过程中学习Dart,但调试时却感到沮丧。我已经从API提取了一个资源,现在我想将JSON字符串打印到控制台,但是它会一直切断该字符串。

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 to print the JSON string to the console, but it keeps cutting off the string.

所以我实际上有两个问题:终端控制台是否真的是打印调试消息的唯一方法,以及如何打印较大的消息

So I actually have two questions: is the terminal console really the only way to print debug messages and how can I print large strings to the console without them automatically getting cut off?

推荐答案

如何从 dart使用Flutter日志,如何? :developer 库。这是唯一看起来可行的解决方案。尝试如下操作:

How about using the Flutter log from dart:developer library. This is the only solution that seems to work fine. Try it as below:

log(reallyReallyLongText)

输出将是整个长字符串而不会中断,并以 [log]

The output will be the entire long string without breaks and prefixed with [log]

这篇关于从Flutter记录大字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆