VS code does NOT show Flutter errors in debug console

2,592

Solution 1

Another common cause of this, is using the filter box in debug console top right corner, if you typed something by mistake, it'll only show the words containing what you typed, and hide everything else. As mentioned by @jaredbaszler.


The code was passed down by another team mate, after inspecting the MyApp state, I found this in the initState, it was logging all error and not being shown in debug console.

 @override
  void initState() {
    super.initState();
    getLocale();
    configLoading();
    FlutterError.onError = (details, {bool forceReport = false}) {
      sentry.captureException(
        exception: details.exception,
        stackTrace: details.stack,
      );
    };
  }

After removing it,I was happy to see the errors and exactly where they were happening. I discovered this a couple of months ago, and posted the answer in case anybody might run into it. Now it seems easy and makes sense, but I missed it.

Solution 2

In case anyone else stumbles upon this, I'll post my brain dead solution (insert face palm emoji). I couldn't figure out what was going on for a good 2-3 hours as I was getting zero output in the Debug Console tab in the terminal window. Turns out I had tried to filter the text using the filter text box. Since nothing was matching my filter text, it was showing nothing. Then I realized I had some text in the text box denoted below. Hopefully this solution saves someone else from some head scratching.

enter image description here

Share:
2,592
Huthaifa Muayyad
Author by

Huthaifa Muayyad

Changed careers after 10 years of Medicine, transitioned from being an Anesthesiologist into a full-time Software Engineer. In a previous time, people trusted me with their lives, you can trust me with your code. Rule #1: Debugging makes you a better developer. Music producer, you can listen and support our music here ♫.

Updated on December 26, 2022

Comments

  • Huthaifa Muayyad
    Huthaifa Muayyad over 1 year

    For some reason, flutter in VS code stopped showing errors. No runtime or exception errors. Even when I put nulls everywhere on purpose, nothing shows in the console.

    The red crash screen appears on device and emulators, but nothing with the details in console output. Not a single error. This image is what I am talking about, it's gone

    Anybody ran into such a thing? Thanks

  • Huthaifa Muayyad
    Huthaifa Muayyad almost 3 years
    Happens to the best, this is a very common cause and can easily be missed, I have added it to the answer as well. Thanks mate!
  • satyajit
    satyajit almost 2 years
    Faced the same exact thing but saw this correct answer after I figured it out. Glad I am not the only one