Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS code does NOT show Flutter errors in debug console

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

like image 797
Huthaifa Muayyad Avatar asked Dec 14 '20 16:12

Huthaifa Muayyad


2 Answers

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

like image 200
jaredbaszler Avatar answered Oct 24 '22 05:10

jaredbaszler


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.

like image 27
Huthaifa Muayyad Avatar answered Oct 24 '22 06:10

Huthaifa Muayyad