Observatory

Flutter debugging is based on the Dart Observatory tool. Dart Observatory is present in the Dart SDK and helps with profiling and debugging Dart applications such as Flutter apps.

When a Flutter app is started in debug mode (remember the JIT compilation from Chapter 1, An Introduction to Dart), this tool is automatically run, enabling debugging and profiling on the app. By using the flutter run command, you will have the address:port part of the output after the Hot Reload message. This address is the Observatory UI address; we can access it through many web browsers* and this is what it looks like:

There are some web browser with limitations on displaying the Observatory tool. Please check out the existing issue regarding this: https://github.com/dart-lang/sdk/issues/34107.

It prints different information about the app running, such as the Flutter version, used memory, class hierarchy, and logs. Also, an important additional tool can be used, the debug tool:

In this page, as you can see, we have access to all of the debugging functionalities, such as the following:

  • Adding and removing breakpoints
  • Run step by step, line by line
  • Switch and manage isolates
Check all available Observatory UI functionalities and a full usage tutorial at https://dart-lang.github.io/observatory/get-started.html.

When you use some IDE like Visual Studio Code or Android Studio/IntelliJ, you will not be using tools such as the Observatory UI directly. IDEs use Dart Observatory under the hood to expose its functionalities through the IDE interface.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.113.197