cover image
Nitish Kumar Singh
Nitish Kumar Singh
Clock Image 4 minutes
Posted on
September 28, 2020

Flutter Debugging


Lots of time after writing the write code we are unable to get correct result. It get difficult to find the problematic part. Here debugging enter which help us in seeing the path how the code is being executed.

Debugging #

Debugging is all about finding the bug and this one line definition/ statement which is true in my believe.

There are some memes about this debugging and those are quite popular. I will share those at then end of this article.

Step 1-Building Sample App for debugging #

We need some code which we are going to see and see the whole process of value computation/ calculation. Once we make a simple app then I will show you how to debug that. The app will be very simple and I will not take much time in building that.

The code is available at github and I highly I recommend you to follow the article by doing. This is build confidence in you about the debugging.

main.dart
void main(){

}
home.dart
class Home{

}

So this was it its a very simple app and here is a demo video of the app.

Step 2-Start-debugging #

Now it’s time to debug the the app and find why all the four button is not working as expected. Let’s find the bug the by watching the calculation part and identify the buggy part.

I am using VS Code in while writing this article but I will also write instruction for android Studio. You can use any IDE(which support flutter) because all IDE has debugging support.

You might think VS Code is a Editor then does ih has debugging feature. Yes it has and we should be thankful to the Microsoft and Open Source Community.

How to start debugging ? #

Android Studio

  • Click on Run and Start debugging

VS Code

  • Click on Run and Start debugging.

Step 3-Breakpoint #

When run the app and when you debug the app, you will find any difference. App is working as usual and everything is similar as previous. This is because we haven’t used the debugging feature till now.

What is Breakpoint? #

This is one the major feature of debugging which stops the program at specified step(in simple word at specified line). Once the program gets stop you can see the value of the variable and analyse if every variable value is correct or not.

Adding Breakpoint #

Last updated at Monday, Sep 7, 2020 by Nitish Kumar Singh
comments powered by Disqus

Subscribe to our Newsletter


Tweet this article