Error Example:
════════ Exception caught by widgets library ═══════════════════════════════════════════════════════
The following assertion was thrown building Builder(dirty):
type 'int' is not a subtype of type 'String'
I need to see where or which variable is causing this.
Do we have to use breakpoint(s) while debugging a Flutter app or is there something more to it?
I really truly appreciate your input. May I just say that the responses below to this question were perfect. However, there is no code to paste. I had so many bugs. It was just a 1 off question wondering at how one could see the runtime value of variables.
Your response is of huge benefit. Thank you all very much
By the way, the fix to this particular problem can be solved in many ways.
It happens when trying to do:
Text(myDoubleValue.toString());
The way you could fix this is by doing
var myTempValue = myList[counter]['doubleValue'];
(for what its worth) - but the question required more focus on using the debugger than actually solving this 1 issue.
If your question is about how to debug your code - then:
you can add breakpoints by clicking on the right from string numbers (red circles on screenshot)
after this you can run debug from menu or by clicking Shift+F9
Hope this is what you asked for
How to find where or which variable is causing this ? Two ways bellow:
Normally after crash, the first link in call stack take you to the code line which cause the crash.
If you enable All Exceptions in BREAKPOINTS of Debug Panel, you should see the line of crashing immediately when you debug.
Dev Tool
Or you can use Dev Tool as third comment mentioned by #SonofStackoverflow bellow.
DevTools is what your precisely looking for,
For debugging and profiling apps, DevTools might be the first tool you
reach for. DevTools runs in a browser and supports a variety of
features:
• Source-level debugger
• Widget inspector that displays a visual widget tree, and “widget
select” mode where you select a widget in the app and it drills down
to that widget in the tree.
• Memory profiler
• Timeline view that supports tracing, and importing and exporting trace
information Logging view
Excerpt taken from the official Flutter docs,
To know more about DevTools head over to the link given below,
https://flutter.dev/docs/testing/debugging
Related
When we use visual studio code for flutter programming, can we restrict debugging process to user files only? and forbid the debugger from opening and debugging external libraries during the debug session?
I used the debug setting at the bottom of the visual studio main window and set it to my code only, yet, the debugger keeps branching into external files when it reaches a return statement in the widget build method.
Sample statement that causes branching into external libraries during debugging
Sample external library that joins into the debugging process
If I understood correctly, you can click a button on the bottom bar to toggle between Debug my code and Debug my code + packages'.
This button is only visible when you are in debug mode.
Apparently the behavior I described in my question was related to deep Uncaught exceptions.
Enabling All Exceptions and Uncaught Exceptions in the debug window assisted in further exploring the issue.
My issue was related to popping an out-of-context widget which caused abnormal behavior while debugging.
According to the documentation on the new Flutter 2
(https://flutter.dev/docs/development/tools/flutter-fix), whenever a deprecated function is detected it should present an error and a quick fix.
I got the errors, but the quick fix isn't show, only the option to ignore hint.
I'm using vscode, already tryed to use vscode insiders, switch to flutter channel dev (Flutter 2.1), android studio is the same...
Also, when I run "dart fix --dry-run" no warnings are shown:
Computing fixes in project_test (dry run)...
Nothing to fix!
flutter fix is still an early experiment, and can only "fix" things for which it has a before/after mapping for analyzer-reported issues. It will very likely get better over time. Be sure you search the issues list and star any similar issues, or write one of your own so the team knows it's important.
It looks like its a weird issue with dart analyser.
In this particular case only happens if overflow is the only argument and there is a trailing comma.
https://github.com/dart-lang/sdk/issues/45242
I couldn't make it work with other deprecated objects like FlatButton and RaisedButton,
but as Randal Schwartz said flutter fix is still an early experiment
I'm trying to find a solution for high Max Potential First Input Delay on a website I'm auditing. I'm evaluating all the Long Tasks once FMP is triggered. While most are being marked as Recalculated Style, I'm not getting the exact code location of where that is, as shown in the attached screenshot.
Anyone has a recommendation of how to better evaluated the exact code causing the bottleneck
Chrome DevTools Performance Long Task Missing script line
Reply to wOxxOm:
OK so to understand you are referring to the Reveal feature as opposed to the to Bottom-up view.
Is this feature still not created? I am getting bunch of useless info (e.g. when I test google map I get message every few seconds) and it is very anoying. Android studio has this for standard apps development, not sure about flutter. Do others have problem with this and how do you solve it?
Edit: There is now a filter in VS Code - see comments on this answer.
There is not currently any feature to filter the output in the debug console. It's not expected to fill up how you're describing, though a similar issue has been raised about ads here:
https://github.com/Dart-Code/Dart-Code/issues/1980
I haven't yet managed to figure out why there is so much output - Flutter is filtering the output that's sent to VS Code and the messages in that issue don't seem like they should match the filter. Subscribe to that issue for updates that would probably solve this issue too.
In addition of the 1.49 filter, another interesting Debug console feature is comins with VSCode 1.52 (Nov. 2020)
Debug Console: collapse identical lines
Debug console now collapses identical output by showing the count of how many times it occurred.
This feature should make it much easier to make sense of very repetitive program output.
I very often get error from angular.js, googleapi etc. like "undefined is not a function".
The problem is that I can't figure out how to find the instruction (written by me) who caused the error.
Normally I can use the debugger but there is a huge stack of calls and it's very difficult/long to find the original problem.
This is even more difficult while working with Google API's minified js.
Any clue?
Thanks in advance
In the debugger use breakpoint, or put it in your code with :
debugger;
If the console is up, the code will stop, helping you to do step by step process.
More info : https://developer.chrome.com/devtools/docs/javascript-debugging
Also maybe, you will have more info with a dev version of chrome https://www.google.fr/chrome/browser/canary.html
In the Sources Inspector of the Chrome DevTools you can press the Pause button (the one on the far right). This will cause the code to stop prior to the exception and maybe this can help you identify the cause of the problem, since you can inspect the scope variables and use the Console to further investigate the call stack.