如何将数据记录到Flutter控制台? [英] How to log data to the Flutter console?

查看:196
本文介绍了如何将数据记录到Flutter控制台?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Flutter开发人员:)

Hello Flutter Devs :)

我是初学者,正在使用IntelliJ IDEA,我想将数据记录到控制台吗?

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

我尝试了 print() printDebug() ,但我的数据都没有显示在Flutter控制台中。

I tried print() and printDebug(), but none of my data were showing in the Flutter console.

推荐答案

如果您在Flutter中小部件,则可以使用 debugPrint ,例如

If you're inside a Flutter Widget, you can use debugPrint, e.g.,

import 'package:flutter/foundation.dart';

debugPrint('movieTitle: $movieTitle');



否则,您可以使用Dart内置的 log 函数

import 'dart:developer';

log('data: $data');

这篇关于如何将数据记录到Flutter控制台?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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