Search code examples
debuggingflutterflutter-test

How to fully dump / print a variable to console in Flutter?


This is a follow-up to this Dart question.

Since Flutter doesn't support reflection and we can't use mirrors, how would you go about debugging, let's say an instance of firebase_database DatabaseReference ? I'm trying to write tests, and knowing what key/values my reference contains will make it easier for me to write a proper test.


Solution

  • since Dart 3.12 you can use inspect(object) to achieve this

    You need to import the developer package: import 'dart:developer';