Repository navigation
Show notification on error with deep link - #5207
Conversation
| final String searchFor = "inspectorRef="; | ||
| final String[] split = url.split("&"); | ||
| for (String part : split) { | ||
| if (part.startsWith(searchFor)) { | ||
| return part.substring(searchFor.length()); | ||
| } | ||
| } | ||
| return null; |
There was a problem hiding this comment.
instead of doing a string search, should we do URI parsing instead and then grab the query param value at 'inspectorRef'?
There was a problem hiding this comment.
Weirdly I can't seem to get a query string from the URL. e.g.
final URI uri = new URI(urlString);
final String[] paramPairs = uri.getQuery() // this is null
maybe because of the # after the port? I'm not sure. Certainly it would be nicer to use more standard parsing, if anyone has suggestions on this.
| return; | ||
| } | ||
|
|
||
| if (StringUtil.equals("DevToolsDeepLinkProperty", property.getType()) && FlutterSettings.getInstance().isEnableEmbeddedBrowsers()) { |
There was a problem hiding this comment.
when we see a DevToolsDeepLinkProperty does this early return guarantee that we don't show the deep link url in the intellij console?
There was a problem hiding this comment.
Right, the early return skips printing in the console. I could add a short description like "Click on notification to inspect widget" or something like that.
| final Notification notification = new Notification( | ||
| FlutterMessages.FLUTTER_NOTIFICATION_GROUP_ID, | ||
| "Inspect this widget", | ||
| "Click below to inspect this exception-causing widget in Flutter DevTools", |
There was a problem hiding this comment.
@csells @InMatrix for input on verbiage
@DanTup sent an example over to me that looked like this:

I think we should try to use consistent wording between the two IDEs, and I actually like how in this screenshot it just grabs the error message directly from the error, so it's consistent with console output as well.
For the button text, I like "Inspect widget"
There was a problem hiding this comment.
maybe change the title text to "Inspect error-causing widget"?
this wording matches what the error message says. For example,
The relevant error-causing widget was:
Column
file:///Users/kenzieschmoll/develop/flutter_vignettes/vignettes/spending_tracker/lib/demo.dart:64:26
There was a problem hiding this comment.
I'm late to the party. The verbiage looks fine. I like the icon in the VS Code version more than the Flutter icon in the IntelliJ version, which signals that this notification is related to an error. For the IntelliJ version, can we go without a title for the message to match the simplicity of the VS Code version?
A related question: how are we handling multiple exceptions thrown at the same time? Will the user get a bunch of notifications at once? For example, this Missing Material Widget error will also generate a RenderFlex Overflow error from the red warning screen on device.
There was a problem hiding this comment.
Will the first error get displayed at the top of the stack or the bottom? The first error is usually relevant to the user's code in my experience.
There was a problem hiding this comment.
Hmm it's the most recent error that gets displayed. When "1 more" is clicked, there's a list shown of all the notifications with their timestamps:

It may be the IntelliJ default to show the most recent at the top so that new notifications aren't missed. I can check whether this can be adjusted for a particular group of errors.
There was a problem hiding this comment.
Thanks for checking. I think we need to try it over a few example errors and determine what makes sense. Flutter framework often throws secondary exceptions down the pipeline caused by the primary error the user can fix in their own code. Maybe there are other filtering strategies we can employ.




When an app throws a render overflow error and sends a URL with a deep link to DevTools, we want to parse the widget ID and open in the embedded DevTools window (if the user has enabled this).
I think we were under the impression that navigating to the same URL but with one param changed should not cause a full page refresh, but I haven't found a way to avoid this.
Fixes #5198