Giter Club home page Giter Club logo

Comments (7)

bleroux avatar bleroux commented on June 2, 2024 3

Thanks for the report. πŸ‘

this exception is caught so I'm not sure if it's an actual issue

I introduced this issue, at that time I did not realize that while the exception is caught it could be annoying when tooling is set to break on all exceptions, for instance on VSCode:
Capture d’écran 2024-03-05 aΜ€ 12 01 11

This was fixed on master and beta by #141205.
For more details, see #144505 (comment).

from flutter.

bleroux avatar bleroux commented on June 2, 2024 1

Interesting.
From the Dart page you pointed, my reading of "Exceptions are errors indicating that something unexpected happened. ", is that 'unexpected' does not apply to this specific case (checking if the result of queryTextActions is null as I did initially).

as a Flutter developer, you have different constraints than an App developer?

I think every frameworks and apps set their own priorities. For Flutter, developper experience is a very high priority (see https://github.com/flutter/flutter/wiki/Values#-focus-on-the-user-and-all-else-will-follow). That's why the annoyance of having VS debugger (and probably other debuggers) stopping on this particular exception had to be considered (especially because, in this particular case, there was a more developper friendly alternative).

from flutter.

darshankawar avatar darshankawar commented on June 2, 2024

Thanks @bleroux for the tip.

@stephane-archer I verified this on master and didn't get any exception while opening the dialog running the code sample on desktop, mobile and web platforms.
Based on above comment and since the fix is in place in master, I'll close this as fixed per triage policy. If you disagree, write in comments and I'll reopen it.

from flutter.

stephane-archer avatar stephane-archer commented on June 2, 2024

thanks, @bleroux and @darshankawar for being so reactive, so from my understanding, Dart recommended error handling is to use exception but the Flutter team can not use that because of VScode πŸ˜…. https://dart.dev/language/error-handling

from flutter.

bleroux avatar bleroux commented on June 2, 2024

thanks, @bleroux and @darshankawar for being so reactive,

πŸ™

so from my understanding, Dart recommended error handling is to use exception but the Flutter team can not use that because of VScode πŸ˜…. https://dart.dev/language/error-handling

Not exactly, here I made a basic mistake πŸ˜… which was to rely on exception for a non-exceptionnal case which was queryTextActions returning null. It is non-exceptionnal because this is intended on platforms that does not implement this feature on the engine side and it was possible to take care of this case without relying on exception.

from flutter.

stephane-archer avatar stephane-archer commented on June 2, 2024

@bleroux you mention that exceptions should be used only for exceptional cases, and while it is true for some languages (C++, Go), the documentation of Dart only mentions for error handling to use exceptions https://dart.dev/language/error-handling
Exceptions usually simplify the return types of the API and help separate the bad and the happy paths.
In some languages, it's the preferred way for error handling.
Reading the documentation I understood that exceptions could be used not only for exceptional cases.
Do you know if my understanding was wrong or is it because as a Flutter developer, you have different constraints than an App developer?

from flutter.

github-actions avatar github-actions commented on June 2, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

from flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.