0

I am trying to debug an issue in a pure dart code. In flutter I use debugPrint() and I found the note that inspect() does this with Dart. However, nothing happens, log() neither. Only print() provides an input. However, I have a complex object, and I would rather not transform all its content into strings.

So how can I output a data object for debugging purposes with Dart (and IntelliJ Idea)?

w461
  • 2,168
  • 4
  • 14
  • 40
  • Add an overridden toString method to your class and have it output whatever information you really need for debugging purposes, and print that. – Jeff Matchett Nov 12 '22 at 23:29
  • https://stackoverflow.com/questions/22921222/default-stringify-for-objects-equivalent-to-javas-tostring – Jeff Matchett Nov 12 '22 at 23:37
  • Thanks, yes this is actually a way to do it. But do you know, what this inspect() command is about (I changed my question, because I wrote console() instead of inspect() ) – w461 Nov 13 '22 at 07:25
  • From my understanding it is just a way to represent an object in a place you may want to look at its contents when stepping through code with a debugger. – Jeff Matchett Nov 14 '22 at 00:27

0 Answers0