title: How to fully dump / print variable to console in the Dart language?
body: <p>Hey there I am searching for a function which is printing a dynamic variable as completely as possible to the console in Dart language.</p>
  
  <p>In <strong>PHP</strong> for instance I would use <code>var_dump()</code> in order to get all information about a variable.</p>
  
  <p>In <strong>JavaScript</strong> I would do one of the following:</p>
  
  <p>1) Convert Object to JSON and print console.log(JSON.stringify(obj))</p>
  
  <p>2) Or a custom function like this:</p>
  
  <pre><code> function dump(arr,level) {
    var dumped_text = "";
    if(!level) level = 0;
  
    //The padding given at the beginning of the line.
    var level_padding = "";
    for(var j=0;j&lt;level+1;j++) level_padding += "    ";
  
    if(typeof(arr) == 'object') { //Array/Hashes/Objects 
     for(var item in arr) {
      var value = arr[item];
  
      if(typeof(value) == 'object') { //If it is an array,
       dumped_text += level_padding + "'" + item + "' ...\n";
       dumped_text += dump(value,level+1);
      } else {
       dumped_text += level_padding + "'" + item + "' =&gt; \"" + value + "\"\n";
      }
     }
    } else { //Stings/Chars/Numbers etc.
     dumped_text = "===&gt;"+arr+"&lt;===("+typeof(arr)+")";
    }
    return dumped_text;
   }
  </code></pre>
  
  <p>However in <strong>Dart</strong> if I do <code>print(variable)</code> I get something like <code>Instance of 'FooBarObject'</code>. I cannot just convert an object to JSON like in JavaScript as this is not possible for all objects.</p>
  
  <p>So my question in detail: </p>
  
  <blockquote>
    <p>Is where a function or custom function in dart which can print a variable with unknown type (object, array, etc.) including all (public) properties as well as nested objects and variables to my console? Or which function is closest to this desire?</p>
  </blockquote>