text:
Don't abandon AngularDart, don't give up on AngularDart

Don't abandon AngularDart, don't give up on AngularDart, me and my company are investing heavily in AngularDart, we are migrating all our web applications to AngularDart, I love Flutter for Mobile, but Flutter is not WEB-productive. WEB, we can't use many existing HTML and CSS templates, because in Flutter we can't use HTML and CSS.

[x] Dart SDK 2.5.2
[x] AngularDart 5.3.0
[x] Windows 1903
[x] Chrome 77

My company is investing heavily projects using AngularDart too. We are really fan this powerful framework and the possibility to use all html and css features necessary to complex web app.
Long life to the AngularDart and Components!

the documentation site still updated daily ^1,
but the framework has no more updates since August 2019. ^2

good news, the framework ^1 get updates :laughing:

good news, the framework ^1 get updates laughing

Really good news, I was really worried about the inactivity of repo. I hope Flutter will take the developers to try AngularDart

@DevAlves1993
I totally agree with you

I hope Flutter will take the developers to try AngularDart

I see AngularDart as a much cleaner, nicer, organized and simple version of Angular. I particularly see TypeScript syntax very ugly and dirty. There are some areas of AngularDart that can improve, especially the router part and simpler forms of serialization.

I started learning Angular with TypeScript using some Udemy tutorials but I didn't even understand anything. So I had to give up on Angular. But After Flutter announces Flutter for Web I started learning Dart. It is really easy to learn. Since Flutter for Web is not yet ready for production, I moved to AngularDart. I learned everything using Documents. I was not able to find any Video Tutorials. Documentation is perfect for a beginner to learn it. I would really need Angular Dart to be added with some more features without giving it up.

Long life to the AngularDart and Components!

We need an official status update.
I heard Google uses AngularDart for AdWords and other teams also prefer Dart version. Is it still true?

We need an official status update.
I heard Google uses AngularDart for AdWords and other teams also prefer Dart version. Is it still true?

Problem that AdWords was on GWT and we know what happened(

@Bellski

Problem that AdWords was on GWT and we know what happened

What happened?

@Bellski

Problem that AdWords was on GWT and we know what happened

What happened?

Google moved from GWT to Dart. And stopped support GWT.

@Bellski

Long life to the AngularDart and Components!

I really hope Google will not abandon AngularDart, otherwise my organization and I will be greatly damaged.
If Flutter is successfully ported to the Web.
I think AngularDart runs on Flutter, because the angular templates HTML can be compiled for Flutter widgets. I've seen some projects here on github that use compiled XML for Flutter widgets, so this is very possible.

Hi there -- thank you for your passion for AngularDart! It's always exciting to see others who are getting value out of this project. It's encouraging to see this issue get a ton of thumbs up.
Firstly, let me (partly) reassure you. AngularDart is not going away and is as actively developed as ever, although we have shifted our focus a little.
As you have noticed, our activity on GitHub has become more bursty in recent months. Because of the heavy usage of AngularDart internally within Google, we moved the primary source of truth to google3, our internal mono-repo. Our goal is to push out new code to GitHub periodically, and we're in the process of automating this so that we’re able to improve the frequency of these syncs. And as you've seen, in the past few days, a large number of changes have landed from a broad set of contributors that bring GitHub up to date.
But yes: we also want to be honest that our focus has shifted somewhat, recognizing the heavy internal usage of AngularDart and comparatively low external developer base. AngularDart is ideal for large-scale data-heavy apps like AdWords with millions of lines of code, but there just aren't that many of this kind of app externally, and we've gradually recognized that. Externally we have a loyal but relatively small following, but AngularDart is probably never going to be a broad general-purpose web framework. Conversely, we have a growing audience of thousands of Google engineers using AngularDart internally, and so most of the features we build are with that audience in mind, knowing that what they need will likely also be of value to external developers.
Lastly, we want to recognize that with the emergence of Flutter’s support for the web, we have other motivations to continue to develop Dart web scenarios - from improved IDE tooling to compilers. In fact, our level of investment in web tooling for Dart is higher than ever, with more engineers working in this space than at any previous point in the project's history.
So, to summarize:

We're continuing to develop AngularDart, although our orientation has slightly shifted towards our internal audience, where it's proven very successful.
We will continue to release AngularDart builds externally to GitHub. Success for the project isn't measured by us in how many millions of external web developers adopt it, but we are delighted to have you as a customer if it suits your needs.

Hahahahahahahahahahaha. Idiots.

@timsneath You are such a liar. Just tell the poor Google dev victims they are doomed and fucked up by Google yet again. Those lies per lies, do you even care about your karma?

@timsneath Please, don't lie.

Anyone who believes it is an idiot.

AngularDart the best fraemwork in the world and it can become mega popular for this you need to start writing normal documentation, which would be supplemented, what is this tutorial where there is no word about the output of images on the site? how do I make friends with DjangoRestFramework or PHP? there are not so many server languages, you can write how to make friends with them, we noobs also want to be part of the team ANGULARDART

AngularDart is ideal for large-scale data-heavy apps like AdWords with millions of lines of code, but there just aren't that many of this kind of app externally

Another use case for AngularDart is sharing the business logic layer from a flutter app with a web app. As flutter for web matures, this probably isn't a long-term use case, but flutter web maturity seems a long way out especially with plugin compatibilities.

@timsneath, I think it is very important to have information about the next steps of Google products.
First, it is a gratitude that we have Google sharing its technologies. As a company admired for its audacity, business models and technology many seek to mirror and use what is available to it, especially when open source.
I have been following and using Dart Lang for several years. It is a wonderful technology. However, one point has always made me apprehensive and anxious about the future: Lack of clear communication about the next steps, especially about the scope of development and release milestones.
As an open source product, in which many use and would also like to contribute to development, I see as important an additional effort to clearly manage communication, thereby aligning the expectations of both Google's internal team and external community.
An improvement in this sense, in addition to aligning expectations, would cause the community in general to create greater confidence about the future and thus generate greater adoption of Dart Lang, AngularDart, etc.
The technology is fantastic, I think adding a dash of management would make it even better.

Is the version of Angular targeted by AngularDart internally at Google keeping up with the latest regular Angular releases (i.e. the 9.0 version)?  The version on github seems to be a bit behind the main Angular releases.  I am almost more inclined to use the regular Angular only to take advantage of the new Ivy capabilities versus those in the 5.0 Angular version targeted by AngularDart.  In general, though, thanks so much for your work on this product!

Is the version of Angular targeted by AngularDart internally at Google keeping up with the latest regular Angular releases (i.e. the 9.0 version)?

Hey @levinem – while both flavors of Angular (JS/TS vs Dart) share a history, they have diverged in many ways – mostly to align better with features in their respective platforms and to address issues with their core customers.

Is the version of Angular targeted by AngularDart internally at Google keeping up with the latest regular Angular releases (i.e. the 9.0 version)?

Hey @levinem – while both flavors of Angular (JS/TS vs Dart) share a history, they have diverged in many ways – mostly to align better with features in their respective platforms and to address issues with their core customers.

Thanks @kevmoo , I had thought that AngularDart was a Dart interface to the Angular main compiler, but it sounds like the underlying compiler infrastructures are not fundamentally connected and that AngularDart will try to keep the main interfaces and concepts similar to those in the JS/TS Angular project to enable a familiar interface for existing JS/TS Angular developers.

AngularDart will try to keep the main interfaces and concepts similar to those in the JS/TS Angular project to enable a familiar interface for existing JS/TS Angular developers.

@levinem – I wouldn't go that far. The engineering teams are friendly, but they are separate teams. There is no explicit goal to keep things aligned – but there is no incentive to diverge either, unless there is a good reason.

@timsneath I worked for 2 years on a project that was angularjs, in the last 8 months I was on the project, the team migrated to AngularDart. We rebuilt everything in AngularDart.
We also created Dart-based command line tools to ease our development workflow.
We created a generator tool to build our domain classes based on whatever client we were developing for.
Lastly, we created our own version of Pub to host our internal code.
The team was sold on the migration due to A) Dart's capabilities, B) Ease of taking existing web elements (HTML, CSS, and JS) into AngularDart variations, and C) Google's own investment and use of AngularDart for its Adwords, and other internal products.
The project is within the government space, so I cannot share details. But the product we developed consisted of over 15-20 microservices.
I hope this can tell you that it is absolutely an enterprise application. We needed Dart's strong type system so that we reduce the ambiguity within our logic.
AngularDart has a space externally from Google, but Google HAS to be public with its support.
My last point, AngularDart and the Dart platform itself, should allow dart:html to exist so that other frameworks and/or smaller apps can be built.
If Google doesn't show support and love for Dart and AngularDart like it does for Flutter, then it's all going to fall apart. That would be a shame, because there's real gold here.
And I concur with @supermuka about next steps for Dart and Angular Dart. These need to be public, even if short-term. Otherwise, no one will engage with what appears to be a ghost town run by ghosts.

@timsneath
First of all, I would like to thank you for your words and feedback.
@Stargator

If Google doesn't show support and love for Dart and AngularDart like it does for Flutter, then it's all going to fall apart. That would be a shame, because there's real gold here.

I totally agree with you, I am also working on several AngularDart projects for the Government of Brazil, I love AngularDart, I love the dart, we cannot let this wonderful tool die.

We're actively working to onboard someone to start the external rolls of angulardart. We're blocked by some paperwork, but we're working through it.
Thank you all for your interest and patience!

AngularDart is ideal for large-scale data-heavy apps like AdWords with millions of lines of code

@timsneath
Sorry about non-subject question. Please, could you tell me how you develop such large-scale apps if there is no even data-tables in angular_components? Do you develop any internal Google UI Kit for that?
Because now we are developing an Angular Dart application (it was customer's choice) and we have a lot of question about angular_components. Our UI/UX architect makes mock ups according to https://material.io/design/ but we can not found some material components (data-tables or grid system, for example) in angular_components for design implementation.
Could you recomend something for us? Thank you!

@anton-marchenko
Google has its own data table components,
that's planned to release to angular_components since Q4 2018, but still not happening till today.
there are several open-source components that you can use from pub.dev.

This video series is a great intro to AngularDart for complete beginners:
https://www.youtube.com/watch?v=9X88k6kTuNw&list=PL3UwowPBo8XHbU4llLYZKY-FOofDLMv8S
Works thru an app from scratch, all the way to a working app with a firebase backend.

@anton-marchenko We have build a number of Material Components that were missing from the official Angular Components library (data table included). See the gallery at https://skawa-universe.github.io/skawa_components_example/, the sources https://github.com/skawa-universe/skawa_components, and the published packages at https://pub.dev/packages?q=skawa+components

@anton-marchenko We have build a number of Material Components that were missing from the official Angular Components library (data table included). See the gallery at https://skawa-universe.github.io/skawa_components_example/, the sources https://github.com/skawa-universe/skawa_components, and the published packages at https://pub.dev/packages?q=skawa+components

@szepeshazi Thank you for your feedback.  Unfortunately we have a limit time budget for our project. Because of this we decided to rewrite the whole our project to Angular TypeScript.
Moreover, we did NOT found  that skawa table is component that completely satisfying our humble needs.

Hi there -- thank you for your passion for AngularDart! It's always exciting to see others who are getting value out of this project. It's encouraging to see this issue get a ton of thumbs up.
Firstly, let me (partly) reassure you. AngularDart is not going away and is as actively developed as ever, although we have shifted our focus a little.
As you have noticed, our activity on GitHub has become more bursty in recent months. Because of the heavy usage of AngularDart internally within Google, we moved the primary source of truth to google3, our internal mono-repo. Our goal is to push out new code to GitHub periodically, and we're in the process of automating this so that we’re able to improve the frequency of these syncs. And as you've seen, in the past few days, a large number of changes have landed from a broad set of contributors that bring GitHub up to date.
But yes: we also want to be honest that our focus has shifted somewhat, recognizing the heavy internal usage of AngularDart and comparatively low external developer base. AngularDart is ideal for large-scale data-heavy apps like AdWords with millions of lines of code, but there just aren't that many of this kind of app externally, and we've gradually recognized that. Externally we have a loyal but relatively small following, but AngularDart is probably never going to be a broad general-purpose web framework. Conversely, we have a growing audience of thousands of Google engineers using AngularDart internally, and so most of the features we build are with that audience in mind, knowing that what they need will likely also be of value to external developers.
Lastly, we want to recognize that with the emergence of Flutter’s support for the web, we have other motivations to continue to develop Dart web scenarios - from improved IDE tooling to compilers. In fact, our level of investment in web tooling for Dart is higher than ever, with more engineers working in this space than at any previous point in the project's history.
So, to summarize:

We're continuing to develop AngularDart, although our orientation has slightly shifted towards our internal audience, where it's proven very successful.
We will continue to release AngularDart builds externally to GitHub. Success for the project isn't measured by us in how many millions of external web developers adopt it, but we are delighted to have you as a customer if it suits your needs.

So in essence, do you plan on making any sorts of releases anytime soon? This is a dead serious question since we have an extremely large project at work, which by all means is comparable to AdWords. We have reached a point where we need to re-do a lot of the frontend, and while I rarely do anything there, I would like to use anything other than javascript(or typescript, which still lives within the Stephen King realm of horror that is the npm ecosystem: fun to read, not so much to live in). With this in mind, AngularDart seems like the only viable alternative. New releases and updates,

Come on @axegon, soldier on. Microsoft just acquired npm and will finally make it super reliable.
/s
What do you currently miss from AngularDart apart from UI comps ? The framework is a bit rough on the edges, but surely nothing is a deal breaker ?
Personally I don't get the enthusiasm for Flutter web. Correct me if I am wrong but it will make apps run on a canvas, the same way Flash worked ? If so performance will never be amazing.

@stanislasdrg even if an alien species acquires npm, it is far beyond repair(assuming there was something to repair, considering it's js). To be fair I don't miss anything from AngularDart. But much like anything else, you don't want to use something that isn't supported in any way, do you? It's all fun and games until everything stops working.
Flutter web, while promising is not a viable solution for anything other than mobile web I'm afraid. I played around with it some time ago - great performance, 0 usability on desktop(you can check my github.io for an example).

We are actively working to bring on the resources needed to continue releasing this package.
Sadly, timing aligned with global events to slow everything down.
Please know this is important to the team and we continue to make progress – just at a pace we all wish was quicker.

@kevmoo
First of all, I would like to thank you for your words and feedback.

@kevmoo @timsneath Thank you for reassuring us that you intend to keep the framework going. I was wondering whether to keep making AngularDart tutorials so your responses tell me to continue doing so. @mmcc007 Thanks for sharing the playlist 😉

The flutter is inspired by React. I know redux is pretty good pattern but it has limits on any web architectures, and not friendly web than Angular.
Cheer AngularDart, you should attract nest, ivy, karma or many developers. I hope really to activate this project.

Looks like we're getting another sync soon! https://github.com/dart-lang/angular/pull/1892

Looks like we're getting another sync soon! #1892

that pr seems quite big

sdk: ">=2.8.1 <3.0.0", that should solve many dependencies constraints errors

@kevmoo @timsneath I recommend you pin this issue so folks find it easier and hopefully avoid creating new issues on the same topic.

Very good to know that there is work behind the scenes.
https://github.com/dart-lang/angular/pull/1892

I think this tweet from the Group Product Manager for Flutter and Dart makes it clear

I think this tweet from the "Group Product Manager for Flutter and Dart" from Google makes it clear.
Flutter Web is the priority for Google

Guess I'll be cutting down on the AngularDart tutorials then.

I think this tweet from @timsneath "Group Product Manager for Flutter and Dart" from Google makes it clear.
Flutter Web is the priority for Google

This is too bad... you don't have to draw everything on canvas. Angular Dart has so much potential... . Dart is getting fame because of Flutter, people start learning it,... Angular Dart is good for anyone familiar with Angular TS, and this is the right tool to use. Imagine... Angular Dart, Aqueduct, Flutter... we are kicking Javascript left and right... (as someone with background of .net C#, words can't describe how much I dislike Javascript) Come on.

I think this tweet from @timsneath "Group Product Manager for Flutter and Dart" from Google makes it clear.
Flutter Web is the priority for Google

This is too bad... you don't have to draw everything on canvas. Angular Dart has so much potential... . Dart is getting fame because of Flutter, people start learning it,... Angular Dart is good for anyone familiar with Angular TS, and this is the right tool to use. Imagine... Angular Dart, Aqueduct, Flutter... we are kicking Javascript left and right... (as someone with background of .net C#, words can't describe how much I dislike Javascript) Come on.

Absolutely! Granted that the sync goes through sometime in the near future, I think someone should fork it and try to build a community around it and hopefully keep it alive. Personally, I'd be more than happy to contribute, despite having some time constraints.

I think this tweet from @timsneath "Group Product Manager for Flutter and Dart" from Google makes it clear.
Flutter Web is the priority for Google

This is too bad... you don't have to draw everything on canvas. Angular Dart has so much potential... . Dart is getting fame because of Flutter, people start learning it,... Angular Dart is good for anyone familiar with Angular TS, and this is the right tool to use. Imagine... Angular Dart, Aqueduct, Flutter... we are kicking Javascript left and right... (as someone with background of .net C#, words can't describe how much I dislike Javascript) Come on.

Absolutely! Granted that the sync goes through sometime in the near future, I think someone should fork it and try to build a community around it and hopefully keep it alive. Personally, I'd be more than happy to contribute, despite having some time constraints.

Sometimes, I think, because AngularDart is so fantastic and Google uses it a lot internally, Google may not want to share with the community this powerful structure that allows to develop in a pleasant way, magnificent, robust and complex applications.
I've been hoping to see updates for a long time, but it's becoming increasingly clear in the leaders' messages that the focus is different. Unfortunately!
Perhaps there will be two ways to see the evolution of AngularDart: working at Google :) or the community fork and evolve the framework itself.

You might want to stop copying that image into every reply, since it makes it harder to follow the thread :)
I know that this is a nuanced message, which therefore runs the risk of misinterpretation, so let me reiterate a few things:

We're continuing to actively develop AngularDart
Our primary audience is more Google-centric than it used to be, because we're seeing heavy usage in critical projects that pay our salaries
We're continuing to ship new builds externally, and we have one on the way when we've resolved various sync issues
We know AngularDart is fantastic: and we're glad you know, @supermuka :)
Flutter's web support isn't ready yet, we know. We're investing there because we are excited about it's long-term potential and we want to give it the very best shot at success.
No need for the community to fork AngularDart, since we're continuing to release new builds -- although of course you're welcome to do so as you always have been -- it's open source, after all!

so,
have you checked the new merge on master branch? :+1:
angular 6.0.0-dev
did anyone try it?

@timsneath can you share with us a road map for flutter web support, it is crucial information that I think Google must share with the community.

We're pretty open about our roadmap and progress, @bshlomo. Most recently, we posted this:
https://medium.com/flutter/going-deeper-with-flutters-web-support-66d7ad95eb52
Our focus right now is getting web support into the Flutter stable channel, which means completing work on CanvasKit support, accessibility, performance and plugins.  That will give us a solid foundation for further feature development work.

angulardart for creating sites (full-fledged sites) is the best choice, flutter now has a number of disadvantages that not everyone is ready to accept, as an example, not being able to copy text

Thank you @timsneath for the link abut flutter-web-support, very professional, and it seems that Google is doing a wonderful job.
Still, the unavoidable question is when?
We are in a situation that we need to make a decision with which technology to port & enhance a huge application that needs to be run in a browser & mobile from Java to Dart the alternatives are dart:html package, AngularDart or to wait for Flutter on the web
Road map information will help us to make the right decision.
No one can ignore Google's investment in Flutter, and it is pretty clear where the efforts are, and what will be in the future, but it will preferable if Google will be more clear about when we can start using Flutter on the web, even some rouge estimation will be most valuable to a lot of teams out there

@bshlomo as someone that's built & launched app on both Angular Dart & Flutter I would strongly recommend flutter for any new project. I can elaborate if you need but I don't want to derail this topic. Gitter is probably a better place to discuss, feel free to ping me.

@bshlomo as someone that's built & launched app on both Angular Dart & Flutter I would strongly recommend flutter for any new project. I can elaborate if you need but I don't want to derail this topic. Gitter is probably a better place to discuss, feel free to ping me.

Could we have a Discussions tab as to https://github.com/dear-github/dear-github/issues/44?

@bshlomo as someone that's built & launched app on both Angular Dart & Flutter I would strongly recommend flutter for any new project. I can elaborate if you need but I don't want to derail this topic. Gitter is probably a better place to discuss, feel free to ping me.

You could create an article in medium or some other blog system.
We are very interested in your story and arguments to use flutter web for new projects.
In a few months ahead we will be in the same position as @bshlomo and this would help a lot in the decision.

Thank you for your interest in this subject
I am sure that this issue (Web/Desktop development with Dart) is a "must clear" and the responsibility is on Google's.
Google must share with us more information about Flutter and or Angular Dart directions, milestones, dates, etc..
You can't pull thousands of developers after you, while they are asking (and not getting) some relevant information that is a standard in this industry and we call it "product's road map"
The effort, difficulty, challenge, and risk (and we all appreciate the wonderful job Google is doing on this) can't cause Google to ignore our needs as users for valuable information that will help us make our own decisions, I am sure that Google doesn't want that we lose money and time by making wrong decisions that result from a lack of basic but committed information.
Why send someone to start development with a dead product?
A development cycle can take years, why let us start a project with the wrong tools.
We don't want to guess, and this is not a quiz, we truly need answers and commitment, I sure that Google can supply them both.
About @jodinathan suggestion - article in medium - a very good idea
About @Sunbreak  suggestion - I don't know how to do it
About @jimmyff offer - I don't have Gitter, I will try to install it and ping you

@bshlomo Thumbs up https://github.com/dear-github/dear-github/issues/44 may help a lot
And it seems that GitHub prefers frontend frameworks/libs than any than repos:

https://github.com/zeit/next.js/discussions
https://github.com/cuelang/cue/discussions
https://github.com/cuelang/cue/discussions
https://github.com/pikapkg/snowpack/discussion

I use AngularDart extensively in a multitude of projects, in the company where I work, and particularly I love AngularDart.
I also use Flutter a lot for mobile applications and I love that too.
I think that Flutter has potential on the WEB for some scenarios, but not for all scenarios. I think that a WEB tool / framework for all scenarios has to support HTML and CSS and that AngularDart does very well.
I see that in the long term in the future if Flutter was executed in WebAssembly and using WebGPU this would bring high performance that would allow to port the html template language from Angular to Flutter this would bring the possibility of using Flutter with and without HTML, it already has some projects on GitHub that show that it is very possible to do this, for example there are some projects that show HTML rendering for Flutter widgets that would bring the best of both worlds.

Please add tutorial, Angulardart + gRPC and shelf or aqueduct(dart for backend) mmmm?

As far as I know, we need to route GRPC request through a proxy, and certain things are still not supported for example streamed input and streamed output.
The grpc-web example which I already looked through requires a GRPC web capable server, and currently the only working implementation of such server is written in node.js I was unable to find an example that makes us of Golang server.
GRPC must be implemented as a protocol in the web browser similar to HTTP to make it work without hacks.

You can use grpcwebproxy or Envoy for this which I've used in a pure Dart stack before. That being said, this is getting rather off-topic for this issue and further discussion related to GRPC in particular should probably be elsewhere...

Closing issue to avoid it becoming a suggestion box for all new feature requests :)
We have a new release coming imminently; our commitment to AngularDart is solid, albeit with a more pronounced focus on Google's large scale apps like Google Ads and Play Console.

Please see https://groups.google.com/a/dartlang.org/g/announce/c/Kz84KNBcf3U !

authors: Bellski CoreyCole DartViet DevAlves1993 Dimous GowthamF MitaiGit Overfacto Stargator Sunbreak anton-marchenko axegon bshlomo e-belair francovp graphicbeacon insinfo jimmyff jodinathan kevmoo levinem mmcc007 oonid p554157atch quangv refi64 stanislasdrg steida supermuka szepeshazi timsneath

repo: dart-lang/angular


text:
Facade gen failed for service worker api definition file.

Dart facade genration failed for service_worker_api typescript definition file, especially supporting ES6 promises.
dart_js_facade_gen service_worker_api.d.ts > service_worker_api.dart
 service_worker_api.d.ts:657:38: ',' expected.
 service_worker_api.d.ts:659:58: ']' expected.
 service_worker_api.d.ts:659:59: ')' expected.
 service_worker_api.d.ts:659:60: Property or signature expected.
 service_worker_api.d.ts:659:62: Property or signature expected.
 service_worker_api.d.ts:659:65: Property or signature expected.
 service_worker_api.d.ts:660:20: Expression expected.
 service_worker_api.d.ts:661:5: Declaration or statement expected.
 service_worker_api.d.ts:661:6: Declaration or statement expected.
 service_worker_api.d.ts:661:12: Expression expected.
 service_worker_api.d.ts:662:1: Declaration or statement expected.
 service_worker_api.d.ts:740:38: ',' expected.
 service_worker_api.d.ts:742:49: ']' expected.
 service_worker_api.d.ts:742:50: ')' expected.
 service_worker_api.d.ts:742:51: Property or signature expected.
 service_worker_api.d.ts:742:53: Property or signature expected.
 service_worker_api.d.ts:742:56: Property or signature expected.
 service_worker_api.d.ts:743:20: Expression expected.
 service_worker_api.d.ts:744:5: Declaration or statement expected.
 service_worker_api.d.ts:744:6: Declaration or statement expected.
 service_worker_api.d.ts:744:12: Expression expected.
 service_worker_api.d.ts:745:1: Declaration or statement expected.
 lib.d.ts:16954:11: Interface 'Window' incorrectly extends interface 'ServiceWorkerGlobalScope'.
  Types of property 'addEventListener' are incompatible.
    Type '{ (type: "MSGestureChange", listener: (ev: MSGestureEvent) => any, useCapture?: boolean): void; (...' is not assignable to type '<K extends any, ServiceWorkerEventMap>(type: K, listener: (event?: ServiceWorkerEventMap[]) => an...'.
      Types of parameters 'listener' and 'listener' are incompatible.
        Type '(event?: any[]) => any' is not assignable to type '(ev: MSGestureEvent) => any'.
          Types of parameters 'event' and 'ev' are incompatible.
            Type 'MSGestureEvent' is not assignable to type 'any[]'.
              Property 'length' is missing in type 'MSGestureEvent'.
 service_worker_api.d.ts:7:1: Cannot find name 'whatwg-fetch'.
 service_worker_api.d.ts:49:20: Cannot find name 'Request'.
 service_worker_api.d.ts:49:63: Cannot find name 'Promise'.
 service_worker_api.d.ts:58:23: Cannot find name 'Request'.
 service_worker_api.d.ts:58:66: Cannot find name 'Promise'.
 service_worker_api.d.ts:66:18: Cannot find name 'Request'.
 service_worker_api.d.ts:66:37: Cannot find name 'Promise'.
 service_worker_api.d.ts:74:28: Cannot find name 'Request'.
 service_worker_api.d.ts:74:48: Cannot find name 'Promise'.
 service_worker_api.d.ts:82:18: Cannot find name 'Request'.
 service_worker_api.d.ts:82:37: Cannot find name 'Response'.
 service_worker_api.d.ts:82:48: Cannot find name 'Promise'.
 service_worker_api.d.ts:92:21: Cannot find name 'Request'.
 service_worker_api.d.ts:92:64: Cannot find name 'Promise'.
 service_worker_api.d.ts:100:20: Cannot find name 'Request'.
 service_worker_api.d.ts:100:54: Cannot find name 'Promise'.
 service_worker_api.d.ts:117:20: Cannot find name 'Request'.
 service_worker_api.d.ts:117:63: Cannot find name 'Promise'.
 service_worker_api.d.ts:126:29: Cannot find name 'Promise'.
 service_worker_api.d.ts:134:30: Cannot find name 'Promise'.
 service_worker_api.d.ts:143:32: Cannot find name 'Promise'.
 service_worker_api.d.ts:151:13: Cannot find name 'Promise'.
 service_worker_api.d.ts:190:14: Cannot find name 'Promise'.
 service_worker_api.d.ts:218:28: Cannot find name 'Promise'.
 service_worker_api.d.ts:229:59: Cannot find name 'Promise'.
 service_worker_api.d.ts:237:30: Cannot find name 'Promise'.
 service_worker_api.d.ts:243:14: Cannot find name 'Promise'.
 service_worker_api.d.ts:345:51: Cannot find name 'Promise'.
 service_worker_api.d.ts:351:24: Cannot find name 'Promise'.
 service_worker_api.d.ts:357:22: Cannot find name 'Promise'.
 service_worker_api.d.ts:377:24: Cannot find name 'Promise'.
 service_worker_api.d.ts:400:23: Cannot find name 'Request'.
 service_worker_api.d.ts:417:28: Cannot find name 'Response'.
 service_worker_api.d.ts:578:19: Cannot find name 'Promise'.
 service_worker_api.d.ts:591:11: Interface 'ServiceWorkerContainer' incorrectly extends interface 'EventTarget'.
  Types of property 'addEventListener' are incompatible.
    Type '<K extends any, ServiceWorkerContainerEventMap>(type: K, listener: (event?: ServiceWorkerContaine...' is not assignable to type '(type: string, listener?: EventListener | EventListenerObject, useCapture?: boolean) => void'.
      Types of parameters 'listener' and 'listener' are incompatible.
        Type 'EventListener | EventListenerObject' is not assignable to type '(event?: any[]) => any'.
          Type 'EventListener' is not assignable to type '(event?: any[]) => any'.
            Types of parameters 'evt' and 'event' are incompatible.
              Type 'any[]' is not assignable to type 'Event'.
                Property 'bubbles' is missing in type 'any[]'.
 service_worker_api.d.ts:605:21: Cannot find name 'Promise'.
 service_worker_api.d.ts:637:74: Cannot find name 'Promise'.
 service_worker_api.d.ts:648:38: Cannot find name 'Promise'.
 service_worker_api.d.ts:655:25: Cannot find name 'Promise'.
 service_worker_api.d.ts:657:32: Cannot find name 'keyof'.
 service_worker_api.d.ts:659:20: A parameter initializer is only allowed in a function or constructor implementation.
 service_worker_api.d.ts:659:65: Cannot find name 'any'.
 service_worker_api.d.ts:660:9: Cannot find name 'useCapture'.
 service_worker_api.d.ts:660:22: Cannot find name 'boolean'.
 service_worker_api.d.ts:664:11: Interface 'ServiceWorkerGlobalScope' incorrectly extends interface 'EventTarget'.
  Types of property 'addEventListener' are incompatible.
    Type '<K extends any, ServiceWorkerEventMap>(type: K, listener: (event?: ServiceWorkerEventMap[]) => an...' is not assignable to type '(type: string, listener?: EventListener | EventListenerObject, useCapture?: boolean) => void'.
      Types of parameters 'listener' and 'listener' are incompatible.
        Type 'EventListener | EventListenerObject' is not assignable to type '(event?: any[]) => any'.
          Type 'EventListener' is not assignable to type '(event?: any[]) => any'.
            Types of parameters 'evt' and 'event' are incompatible.
              Type 'any[]' is not assignable to type 'Event'.
 service_worker_api.d.ts:738:20: Cannot find name 'Promise'.
 service_worker_api.d.ts:740:32: Cannot find name 'keyof'.
 service_worker_api.d.ts:742:20: A parameter initializer is only allowed in a function or constructor implementation.
 service_worker_api.d.ts:742:56: Cannot find name 'any'.
 service_worker_api.d.ts:743:9: Cannot find name 'useCapture'.
 service_worker_api.d.ts:743:22: Cannot find name 'boolean'.

The generated code is full of errors.

@jacob314 thoughts?

source: gharchive/issue

authors: kevmoo sureshg

license_type: permissive

license_source: bigquery


text:
ffigen: Don't generate setters for constant globals

ffigen always generates a getter/setter pair for global variables declared in C. But I think for variables declared const in C, writing to their address should be impossible in Dart, just like it is prevented in C.

PTAL as well @mannprerak2.

coverage: 92.677% (+0.008%) from 92.669%
when pulling 74a5df747860ca7bd74784a728ada1eaa5cc8431 on simolus3:constant-globals
into 9f29edc71a3bdd26fee253694796002125416227 on dart-lang:main.

source: gharchive/pull-request

authors: coveralls dcharkes simolus3

repo: dart-lang/native

license_source: github-api


text:
Update sdk version constraint for protobuf

The sdk version constraint for the protobuf package should be updated to >=2.6.0 to support extension method usage. We are running into issues internally where analyzer is flagging the protobuf package
ERROR: ..dart/protobuf/lib/src/protobuf/generated_message.dart:641 Extension methods weren't supported until version 2.6.0, but this code is required to be able to run on earlier versions. #sdk_version_extension_methods

We are running into issues with this as well.
GeneratedMessage.clone()  and GeneratedMessage.copyWith() have both been deprecated about 4 months ago. We would like to be able to start writing code which doesn't call deprecated methods as soon as possible without needing to kludge in a sed to change the @dart = 2.3 annotation.
Are we missing something? Would you like a pull request?

We are running into issues with this as well.
GeneratedMessage.clone()  and GeneratedMessage.copyWith() have both been deprecated about 4 months ago. We would like to be able to start writing code which doesn't call deprecated methods as soon as possible without needing to kludge in a sed to change the @dart = 2.3 annotation.
Are we missing something? Would you like a pull request?

Hmm - not sure what is going on here.
Protobuf 1.1.0 (newest stable) has sdk constraint: "sdk":">=2.7.0 <3.0.0" that should be enough for extension methods?
What version are you on?

Hmm - not sure what is going on here.
Protobuf 1.1.0 (newest stable) has sdk constraint: "sdk":">=2.7.0 <3.0.0" that should be enough for extension methods?
What version are you on?

Ah - it is the generated files!
That should be fixed! Thanks for reporting.

Ah - it is the generated files!
That should be fixed! Thanks for reporting.

authors: keertip serverplumber sigurdm

repo: dart-lang/protobuf


text:
pub global activate protoc_plugin is failing

I get a bunch of compilation errors when I attempt to run pub global activate protoc_plugin.
I'm running on Windows and I've tried:

upgrading Flutter
deleting flutter/bin/cache
deleting $USER/AppData/Roaming/Pub/Cache

But none of those have had any effect.

Logs when I run pub global activate protoc_plugin
Package protoc_plugin is currently active at version 19.0.1.
Resolving dependencies...
+ _fe_analyzer_shared 6.0.0 (11.0.0 available)
+ analyzer 0.39.15 (0.40.4 available)
+ args 1.6.0
+ async 2.4.2 (2.5.0-nullsafety.1 available)
+ charcode 1.1.3 (1.2.0-nullsafety.1 available)
+ cli_util 0.1.4 (0.2.0 available)
+ collection 1.14.13 (1.15.0-nullsafety.3 available)
+ convert 2.1.1
+ crypto 2.1.5
+ csslib 0.16.2
+ dart_style 1.3.3 (1.3.7 available)
+ fixnum 0.10.11
+ glob 1.2.0
+ html 0.14.0+4
+ js 0.6.2 (0.6.3-nullsafety.1 available)
+ meta 1.2.3 (1.3.0-nullsafety.3 available)
+ node_interop 1.1.1
+ node_io 1.1.1
+ package_config 1.1.0 (1.9.3 available)
+ path 1.7.0 (1.8.0-nullsafety.1 available)
+ pedantic 1.9.2 (1.10.0-nullsafety.1 available)
+ protobuf 1.0.1
+ protoc_plugin 19.0.1
+ pub_semver 1.4.4
+ source_span 1.7.0 (1.8.0-nullsafety.2 available)
+ string_scanner 1.0.5 (1.1.0-nullsafety.1 available)
+ term_glyph 1.1.0 (1.2.0-nullsafety.1 available)
+ typed_data 1.2.0 (1.3.0-nullsafety.3 available)
+ watcher 0.9.7+15
+ yaml 2.2.1
Precompiling executables...
Failed to precompile protoc_plugin:bin\protoc_plugin:
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/dart_style-1.3.3/lib/src/dart_formatter.dart:105:30: Error: Too many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
    scanner.configureFeatures(featureSet);
                             ^
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/src/dart/resolver/extension_member_resolver.dart:355:38: Error: The getter 'extensions' isn't defined for the class 'Scope'.
 - 'Scope' is from 'package:analyzer/dart/element/scope.dart' ('../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/dart/element/scope.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'extensions'.
    for (var extension in _nameScope.extensions) {
                                     ^^^^^^^^^^
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/src/dart/resolver/method_invocation_resolver.dart:243:19: Error: The method 'shouldIgnoreUndefined' isn't defined for the class 'Scope'.
 - 'Scope' is from 'package:analyzer/dart/element/scope.dart' ('../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/dart/element/scope.dart').
Try correcting the name to the name of an existing method, or defining a method named 'shouldIgnoreUndefined'.
    if (nameScope.shouldIgnoreUndefined(ignorableIdentifier)) {
                  ^^^^^^^^^^^^^^^^^^^^^
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/src/generated/element_resolver.dart:201:41: Error: The method 'lookupIdentifier' isn't defined for the class 'Scope'.
 - 'Scope' is from 'package:analyzer/dart/element/scope.dart' ('../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/dart/element/scope.dart').
Try correcting the name to the name of an existing method, or defining a method named 'lookupIdentifier'.
          element = _resolver.nameScope.lookupIdentifier(identifier);
                                        ^^^^^^^^^^^^^^^^
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/src/generated/element_resolver.dart:503:45: Error: The method 'lookupIdentifier' isn't defined for the class 'Scope'.
 - 'Scope' is from 'package:analyzer/dart/element/scope.dart' ('../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/dart/element/scope.dart').
Try correcting the name to the name of an existing method, or defining a method named 'lookupIdentifier'.
      Element element = _resolver.nameScope.lookupIdentifier(node);
                                            ^^^^^^^^^^^^^^^^
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/src/generated/element_resolver.dart:509:39: Error: The method 'lookupIdentifier' isn't defined for the class 'Scope'.
 - 'Scope' is from 'package:analyzer/dart/element/scope.dart' ('../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/dart/element/scope.dart').
Try correcting the name to the name of an existing method, or defining a method named 'lookupIdentifier'.
        element = _resolver.nameScope.lookupIdentifier(setterName);
                                      ^^^^^^^^^^^^^^^^
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/src/generated/element_resolver.dart:512:50: Error: The method 'shouldIgnoreUndefined' isn't defined for the class 'Scope'.
 - 'Scope' is from 'package:analyzer/dart/element/scope.dart' ('../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/dart/element/scope.dart').
Try correcting the name to the name of an existing method, or defining a method named 'shouldIgnoreUndefined'.
      if (element == null && _resolver.nameScope.shouldIgnoreUndefined(node)) {
                                                 ^^^^^^^^^^^^^^^^^^^^^
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/src/generated/element_resolver.dart:727:39: Error: The method 'shouldIgnoreUndefined' isn't defined for the class 'Scope'.
 - 'Scope' is from 'package:analyzer/dart/element/scope.dart' ('../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/dart/element/scope.dart').
Try correcting the name to the name of an existing method, or defining a method named 'shouldIgnoreUndefined'.
      } else if (!_resolver.nameScope.shouldIgnoreUndefined(node)) {
                                      ^^^^^^^^^^^^^^^^^^^^^
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/src/generated/element_resolver.dart:805:29: Error: The method 'shouldIgnoreUndefined' isn't defined for the class 'Scope'.
 - 'Scope' is from 'package:analyzer/dart/element/scope.dart' ('../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/dart/element/scope.dart').
Try correcting the name to the name of an existing method, or defining a method named 'shouldIgnoreUndefined'.
        _resolver.nameScope.shouldIgnoreUndefined(superclassName)) {
                            ^^^^^^^^^^^^^^^^^^^^^
Failed to precompile protoc_plugin:bin\protoc_plugin_bazel:
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/dart_style-1.3.3/lib/src/dart_formatter.dart:105:30: Error: Too many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
    scanner.configureFeatures(featureSet);
                             ^
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/src/dart/resolver/extension_member_resolver.dart:355:38: Error: The getter 'extensions' isn't defined for the class 'Scope'.
 - 'Scope' is from 'package:analyzer/dart/element/scope.dart' ('../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/dart/element/scope.dart').
Try correcting the name to the name of an existing getter, or defining a getter or field named 'extensions'.
    for (var extension in _nameScope.extensions) {
                                     ^^^^^^^^^^
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/src/dart/resolver/method_invocation_resolver.dart:243:19: Error: The method 'shouldIgnoreUndefined' isn't defined for the class 'Scope'.
 - 'Scope' is from 'package:analyzer/dart/element/scope.dart' ('../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/dart/element/scope.dart').
Try correcting the name to the name of an existing method, or defining a method named 'shouldIgnoreUndefined'.
    if (nameScope.shouldIgnoreUndefined(ignorableIdentifier)) {
                  ^^^^^^^^^^^^^^^^^^^^^
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/src/generated/element_resolver.dart:201:41: Error: The method 'lookupIdentifier' isn't defined for the class 'Scope'.
 - 'Scope' is from 'package:analyzer/dart/element/scope.dart' ('../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/dart/element/scope.dart').
Try correcting the name to the name of an existing method, or defining a method named 'lookupIdentifier'.
          element = _resolver.nameScope.lookupIdentifier(identifier);
                                        ^^^^^^^^^^^^^^^^
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/src/generated/element_resolver.dart:503:45: Error: The method 'lookupIdentifier' isn't defined for the class 'Scope'.
 - 'Scope' is from 'package:analyzer/dart/element/scope.dart' ('../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/dart/element/scope.dart').
Try correcting the name to the name of an existing method, or defining a method named 'lookupIdentifier'.
      Element element = _resolver.nameScope.lookupIdentifier(node);
                                            ^^^^^^^^^^^^^^^^
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/src/generated/element_resolver.dart:509:39: Error: The method 'lookupIdentifier' isn't defined for the class 'Scope'.
 - 'Scope' is from 'package:analyzer/dart/element/scope.dart' ('../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/dart/element/scope.dart').
Try correcting the name to the name of an existing method, or defining a method named 'lookupIdentifier'.
        element = _resolver.nameScope.lookupIdentifier(setterName);
                                      ^^^^^^^^^^^^^^^^
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/src/generated/element_resolver.dart:512:50: Error: The method 'shouldIgnoreUndefined' isn't defined for the class 'Scope'.
 - 'Scope' is from 'package:analyzer/dart/element/scope.dart' ('../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/dart/element/scope.dart').
Try correcting the name to the name of an existing method, or defining a method named 'shouldIgnoreUndefined'.
      if (element == null && _resolver.nameScope.shouldIgnoreUndefined(node)) {
                                                 ^^^^^^^^^^^^^^^^^^^^^
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/src/generated/element_resolver.dart:727:39: Error: The method 'shouldIgnoreUndefined' isn't defined for the class 'Scope'.
 - 'Scope' is from 'package:analyzer/dart/element/scope.dart' ('../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/dart/element/scope.dart').
Try correcting the name to the name of an existing method, or defining a method named 'shouldIgnoreUndefined'.
      } else if (!_resolver.nameScope.shouldIgnoreUndefined(node)) {
                                      ^^^^^^^^^^^^^^^^^^^^^
../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/src/generated/element_resolver.dart:805:29: Error: The method 'shouldIgnoreUndefined' isn't defined for the class 'Scope'.
 - 'Scope' is from 'package:analyzer/dart/element/scope.dart' ('../../AppData/Roaming/Pub/Cache/hosted/pub.dartlang.org/analyzer-0.39.15/lib/dart/element/scope.dart').
Try correcting the name to the name of an existing method, or defining a method named 'shouldIgnoreUndefined'.
        _resolver.nameScope.shouldIgnoreUndefined(superclassName)) {

debian 10 Google cloud
`Precompiling executables... (4.5s)
Failed to precompile protoc_plugin:protoc_plugin_bazel:
===== CRASH =====
si_signo=Bus error(7), si_code=2, si_addr=0x7f6657400000
===== CRASH =====
si_signo=Bus error(7), si_code=2, si_addr=0x7f66574fa000
Aborting re-entrant request for stack trace.`

@vmahadev – what version of Dart are you using?

@vmahadev – what version of Dart are you using?

Dart SDK version: 2.13.1 (stable) (Fri May 21 12:45:36 2021 +0200) on "windows_x64"

authors: AlabasterAxe MitaiGit kevmoo vmahadev


text:
Fixup "create method" sometimes assigns duplicate parameter names

Starting with the code:
class C {
  int x;
}

class D {
  foo(C c1, C c2) {
    bar(c1.x, c2.x);
  }
}

Place the cursor on the identifier bar and select the "create method" fixup.
The code which is inserted has an error:
void bar(int x, int x) { // Error: the name 'x' is already defined
}

Expected behavior: the generated names should be adjusted so they are unique, e.g. by adding trailing digits, e.g.:
void bar(int x1, int x2) {
}

https://codereview.chromium.org/1664423002

https://github.com/dart-lang/sdk/commit/960b9c34093b9f989074985360e7dbffe06b6318

repo: dart-lang/sdk


text:
Platform.localeName always returns en_US on Android

getenv("LANG") returns NULL. This causes standalone/io/locale_name_test.dart to fail.

We should add a callback to _Platform that the embedder can set to use instead of trying to fish the locale out of an environment variable.

I'm facing up with this issue on flutter 3.10.x
flutter doctor -v
[✓] Flutter (Channel stable, 3.10.5, on macOS 13.3.1 22E772610a darwin-arm64,
    locale en-RU)
    • Flutter version 3.10.5 on channel stable at /Users/nikotron/sdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 796c8ef792 (13 days ago), 2023-06-13 15:51:02 -0700
    • Engine revision 45f6e00911
    • Dart version 3.0.5
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
    • Android SDK at /Users/nikotron/sdk/android-sdk
    • Platform android-33, build-tools 33.0.1
    • ANDROID_HOME = /Users/nikotron/sdk/android-sdk
    • Java binary at: /Applications/Android
      Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      11.0.15+0-b2043.56-8887301)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E222b
    • CocoaPods version 1.12.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.1)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build
      11.0.15+0-b2043.56-8887301)

[✓] VS Code (version 1.80.0-insider)
    • VS Code at /Applications/Visual Studio Code - Insiders.app/Contents
    • Flutter extension version 3.66.0

[✓] Connected device (3 available)
    • Android SDK built for arm64 (mobile) • emulator-5554 • android-arm64  •
      Android 10 (API 29) (emulator)
    • macOS (desktop)                      • macos         • darwin-arm64   •
      macOS 13.3.1 22E772610a darwin-arm64
    • Chrome (web)                         • chrome        • web-javascript •
      Google Chrome 114.0.5735.133

[✓] Network resources
    • All expected network resources are available.

• No issues found!

@NiKoTron This issue has been closed for over five years. Please file a new issue with full details in the flutter/flutter issue tracker.

authors: NiKoTron zanderso


text:
ifdefs or equivalent

I'd like to be able to check, at compile time, whether an environment variable is set, and if so, I'd like to declare a particular identifier as a constant whose value is derived from that environment variable, and if not, I'd like it to be a mutable variable.
Specifically, I'd like defaultTargetPlatform to be const in release builds so that we can tree-shake code that depends on it (and not include iOS logic in Android apps), while in debug builds it remains a variable whose value we can dynamically change via the service protocol extension we have today.

Another use case that's becoming more and more of an issue is developing packages and plugins that need to target multiple versions of Flutter or Dart. For example, we have a policy that our plugins must be compatible with the latest stable release, but we develop against master. This means that when we make a breaking change on master, we have a lot of difficulty. It would be much easier if we could ifdef-out some code for when we're targeting stable and #ifdef-out the equivalent code for when we're targeting master. Or, rather, in practice, mark code blocks as targeting one version of flutter vs another version of flutter. Maybe this means conditions should allow for a syntax similar to pub version constraints, applied against packages that the code is being compiled with.
cc @leafpetersen @munificent @mit-mit

Here's a straw-man proposal that does not solve the two problems described above but might be a starting point for ideas that do solve those problems:
We allow tags to be declared. Tags are defined in terms of enums, and must be given a type and a name, and optionally a default value. For example:
enum BuildMode { debug, profile, release }
enum BuildPlatform { android, iOS, fuchsia, web, windows, macOS, linux }
enum BuildSize { demo, full }
tag BuildMode buildMode;
tag BuildPlatform target;
tag BuildSize game = BuildSize.full; // with default

The compiler can be given a value for each declared tag. It is an error for a tag to be declared without a default value if the compiler was not explicitly given a value for that tag on the command line. It is an error for a tag to be given to the compiler on the command line if no code declares that tag.
Declarations and blocks can be annotated to specify that they only apply when a tag has a particular value or when it does not have a particular value.
class Foo {
  @if(buildMode == BuildMode.debug)
  final Bar baz;
  @if(target != BuildPlatform.web)
  final Bob quux;

  void hello() {
    print('Welcome to the game!');
    @if(game == BuildSize.demo) {
      print('(This is a demo.)');
    }
  }
}

Every declaration and code block implicitly has a list of values that it applies for. By default, code applies to every value of every tag. For example, the class Foo above applies to all three BuildMode values, all seven BuildPlatform values, and both BuildSize values.
Each @if annotation excludes some values from the declaration or code block that it labels. For example, the "baz" field above only applies to the "debug" BuildMode, not the "profile" and "release" build modes. Annotations are of the form "tag != TagEnum.value" or "tag == TagEnum.value", either excluding the specified value or all but the specified value, respectively.
The compiler excludes code that doesn't apply given the values it was given for each tag when compiling.
The analyzer verifies that code only refers to members tagged with a subset of the tags that apply to the code. For example:
enum Foo { a, b }
tag Foo tag1;
tag Foo tag2;

void main() {
  @if(tag1 == Foo.a)
  bool q = true;
  @if(tag1 == Foo.a) {
    q = false;
  }
  @if(tag2 == Foo.a) {
    q = false; // error 1
  }
  print(q); // error 2
}

In this code, the errors happen because those blocks are tagged with tag1 values a and b, whereas q is only tagged with tag1 value a.
A more elaborate example with nested scopes of tagging;
enum Foo { a, b }
tag Foo tag1;
tag Foo tag2;

@if(tag1 == Foo.a)
class Bar {
  @if(tag2 == Foo.b)
  int q = 0;

  @if(tag1 == Foo.b)
  int r = 1; // not an error, but could be a lint (1)

  @if(tag2 == Foo.a)
  void test() {
    print(q); // error (2)
  }
}

void main() {
  print(Bar().q); // error (3)
  @if(tag1 == Foo.a) {
    print(Bar().q); // error (4)
    @if(tag2 != Foo.a) {
      print(Bar().q); // (5)
    }
  }
}

In this example, Bar.r can never be referenced, because it doesn't apply to any value of tag1. This could be a lint (it probably should not be an outright error, because it's harmless enough).
The error marked 2 is invalid because that block applies to value "a" of tag2, whereas "q" is only declared for value "b".
The error marked 3 is invalid because that block applies to all values of tag1 and tag2, whereas Bar is only available for one value of tag1, "a". The error marked 4 is similar; while the call to Bar() is now valid because of the outer @if, the use of Bar.q is invalid since in that block, all values of tag2 apply. The statement in the innermost block, labeled 5, is fine because it only applies for tag1 "a" and tag2 "b".
Adding a new enum value to Foo would make the line marked 5 into an error, because the innermost @if would not exclude this new value (it uses !=) whereas Bar.q is declared using an @if that only allows one value (it uses ==).
For the purposes of control-flow analysis, each @if-annotated code block can be treated like an if statement expressed in terms of a global variable. One possible additional improvement here would be to notice a chain of @if-annotated blocks that cover the full spectrum of values for a particular tag, and treat that as an if-else chain.
Again, this is not a concrete proposal as it does not solve the problems listed for this issue. It's only meant as a starting point for discussion.

We've discussed features similar to this before. I'll quickly walk through the two main problems we ran into that stalled progress on the design. That's not to say that those are necessarily fatal or the only problems, just to give you some context that we have explored this space a little (which implies that your idea has merit) but also that our lack of progress may be because the problem is harder than it first appears.
What is the static analysis user experience?
Allowing "control flow" at the declaration level means that the static shape of a program is no longer, well, static. In some configurations you may get static shape A and in others B. But the user's IDE and static analysis experience is currently "modeless" or configuration independent. When I'm looking at a Dart source file in my editor, I'm not looking at it "in release mode". That's a choice that happens farther downstream. But if the set of static errors that are reported depends on choices like release mode versus debug mode, then the idea of a modeless IDE experience is no longer meaningful.
Concretely, say I had:
enum BuildMode { debug, profile, release }
tag BuildMode buildMode = BuildMode.debug;

class Foo {
  @if(buildMode == BuildMode.debug)
  String field = "value";

  @if(buildMode == BuildMode.release)
  int field = 123;
}

main() {
  String s = Foo().field; // <--
}

Should analyzer report an error on the marked line?
One approach would be to actually make the IDE modal. Have some combo boxes or something where the user picks a specific configuration that they want to view the program as. The two main problems with that are:

For package authors, it means they need to remember to check out their package in all configurations. Otherwise, they risk shipping a package that has compile errors in an overlooked configuration. We basically require users to brute force check all of the combinations.

The set of configurable options (tags in your proposal) is potentially large and confusing. In theory, the IDE would need to give you a dropdown for every single tag in every single package your app transitively depends on. That could scale poorly and be confusing when you see flags that aren't meaningful to you.

Granted, this is sort of what C++ IDEs do, so it's not intractable, but also, uh, it ends up being kind of a crappy user experience. I have repeatedly committed bugs in C programs without realizing because I didn't realize XCode was only showing me the errors for a certain configuration.
The set of configurations is potentially self-referential
One desirable use for ifdefs is applying them to imports. That way, for example, you could only import dart:io on a platform where it's available. Or only import dart:developer in debug builds.
But imported libraries are also the things that define these tags. So you can get into a weird situation where:

In order to process an @if, you need to know the values of all tags.
Which means you need to traverse all the imports to find the tags.
But you don't know "all the imports" until you start evaluating tags.

I believe this means you've have to do some sort of incremental, ordered traversal of imports. That might rule out circular imports (which are very common in Dart today) or mean that the order of import directives in a file has semantic meaning (which means that sorting your imports could break your app). That would be a really big conceptual change in how the library system behaves and not necessarily for the better.

The analyzer verifies that code only refers to members tagged with a subset of the tags that apply to the code.

This is a good attempt to untangle some of the difficulty statically analyzing code that does "static control flow". I could be wrong, but my hunch is that this kind of analysis may actually be intractable/undecidable/Turing-complete/what have you.
If we allow arbitrary Boolean expressions in @if conditions, then I think that means you could express any 3-SAT problem as a set of tags and @if blocks. That implies that this analysis is NP-complete.
I may be wrong about this. Even so, I suspect there are still other cases where that analysis gets really fishy once you take into account inheritance, overrides, const, default values, etc. My spidey sense tingles.
For example, in your initial request, you want to have a variable that is const in some configurations but not in others. Can that variable be used as a default value? Can the analyzer reliably ensure that another member that uses that variable as a default value can't be reached unless the proper tags are set? If that member is in a class that is never used when the variable is non-const, is that sufficient? Does the class itself need to be guarded by @if? If so, does that mean every single place that uses that class also needs the guard? Is there any way to encapsulate a tag such that an @if doesn't bleed out like this?

The strawman above doesn't solve the original problem described at the top of this issue, but FWIW, it doesn't have the problems you list:

in your code snippet, there would be an error because field is declared twice, which isn't valid.

for the imports, you can find all the tags in one pass at the same time as parsing, and then do the analysis thereafter; the tags can't impact the parsing, can't impact the imports, and can't impact other tags.

the @if conditions are explicitly not arbitrary, they are only of the form tag == value or tag != value where value is only allowed to be a literal enum value of the right type.

For example, in your initial request, you want to have a variable that is const in some configurations but not in others

Yeah, I don't know how to solve that. The strawman proposal above doesn't attempt to solve it. I'm still thinking about it. :-)

For the const thing, maybe the solution is to write the code as follows:
Foo get bar => _bar;
Foo _bar = /* a compile-time evaluatable expression */;
@if(buildMode == BuildMode.debug)
set bar(Foo value) {
  _bar = value;
}

The compiler can then be made clever enough to notice that _bar never changes value in release builds, and can therefore be treated like a constant, and that can propagate to the getter, which can then be inlined everywhere, and so on, which gives us the original intent, which is to tree-shake away code that can't be reached given the immutable value of this field in that mode.
This avoids the problems listed above about actually having the field be actually both const and non-const. It's unambiguously non-const, it's just that the compiler can figure out that it might as well be and it can thus get all the benefits of being const.

For the "targeting two different versions of a library" thing, this doesn't seem to really help at all.

authors: Hixie munificent


text:
NoSuchMethodError: The method 'refresh' was called on null.

Analyzer Feedback from IntelliJ
Version information

IDEA IU-191.6183.87
2.2.0-edge.0a7dcf17eb5f2450480527d6ad1e201fb47f1e36
IU-191.6183.87, JRE 1.8.0_202-release-1483-b39x64 JetBrains s.r.o, OS Mac OS X(x86_64) v10.14.4, screens 1920x1200, 1920x1200

Exception
Dart analysis server, SDK version 2.2.0-edge.0a7dcf17eb5f2450480527d6ad1e201fb47f1e36, server version 1.23.0, error: Captured exception
NoSuchMethodError: The method 'refresh' was called on null.
Receiver: null
Tried calling: refresh(Instance of 'DeclarationsContext')
#0      Object.noSuchMethod (dart:core/runtime/libobject_patch.dart:50:5)
#1      DeclarationsTracker._performChangeFile (package:analyzer/src/services/available_declarations.dart:611:15)
#2      DeclarationsTracker.doWork (package:analyzer/src/services/available_declarations.dart:473:7)
#3      CompletionLibrariesWorker.performWork (package:analysis_server/src/domains/completion/available_suggestions.dart:177:13)
<asynchronous suspension>
#4      AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2125:35)
<asynchronous suspension>
#5      AnalysisDriverScheduler.start (package:analyzer/src/dart/analysis/driver.dart:2075:5)
#6      new AnalysisServer (package:analysis_server/src/analysis_server.dart:213:29)
#7      SocketServer.createAnalysisServer (package:analysis_server/src/socket_server.dart:86:26)
#8      StdioAnalysisServer.serveStdio (package:analysis_server/src/server/stdio_server.dart:37:18)
#9      Driver.startAnalysisServer.<anonymous closure> (package:analysis_server/src/server/driver.dart:526:21)
#10     _rootRun (dart:async/zone.dart:1124:13)
#11     _CustomZone.run (dart:async/zone.dart:1021:19)
#12     _runZoned (dart:async/zone.dart:1516:10)
#13     runZoned (dart:async/zone.dart:1463:12)
#14     Driver._captureExceptions (package:analysis_server/src/server/driver.dart:605:12)
#15     Driver.startAnalysisServer (package:analysis_server/src/server/driver.dart:524:7)
#16     Driver.start (package:analysis_server/src/server/driver.dart:427:7)
#17     main (file:///b/rr/tmpgY2JrN/w/src/third_party/dart/pkg/analysis_server/bin/server.dart:12:11)
#18     _AsyncAwaitCompleter.start (dart:async/runtime/libasync_patch.dart:49:6)
#19     main (file:///b/rr/tmpgY2JrN/w/src/third_party/dart/pkg/analysis_server/bin/server.dart:10:10)
#20     _startIsolate.<anonymous closure> (dart:isolate/runtime/libisolate_patch.dart:298:32)
#21     _RawReceivePortImpl._handleMessage (dart:isolate/runtime/libisolate_patch.dart:171:12)

For additional log information, please append the contents of
file:///private/var/folders/y7/lfssy_4x46d9pgdz2b_ylnjr0000gn/T/report.txt.

Thanks for reporting this issue. This was fixed for https://github.com/dart-lang/sdk/issues/36212.

Duplicate of https://github.com/dart-lang/sdk/issues/36212


text:
Dart debugging in Visual Code throws handled exceptions as uncaught

I think this a serious problem when working with dart/flutter.
https://github.com/flutter/flutter/issues/33427

I know it's in poor taste to add a "me too" comment, but this seriously needs attention. I found my issue with flutter, but apparently it's not an isolated issue.

@DanTup

Just to be sure - in the Debug side bar in VS Code, you only have "uncaught exceptions" ticked, and not "all exceptions"?
(cc @zichangg)

In my case, I have double checked that I have only uncaught exceptions ticked.

@Kenji-K thanks!
@zichangg I can repro this using a clean flutter create project and replacing main.dart with the following (and adding google_sign_in: to the pubspec dependencies):
import 'package:flutter/material.dart';
import 'package:google_sign_in/google_sign_in.dart';

void main() {
  runApp(MyApp());
  _silentSignIn();
}

GoogleSignIn _googleSignIn = GoogleSignIn(scopes: <String>['email']);

Future<void> _silentSignIn() async {
  try {
    await _googleSignIn.signInSilently(suppressErrors: false).catchError(print);
  } catch (error) {
    print(error);
  }
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(title: 'Demo', home: Text('test'));
  }
}

It repros in both VS Code and Android Studio (though in Android Studio the editor goes to the source of the exception, whereas VS Code walks up the stack to the first frame that's user code). The source of the exception is here:

As I understood it, the VM should see the catch block in the stack and know that it's handled. I don't know if it's related, but it looks like the exception is caught and rethrown in the frame above the user code:

(I can't edit labels, but this might be area-vm rather than area-analyzer?)

This problem still persists until now, I don't know if the Flutter team is aware of it, but it seems to me that it should be a priority issue.

From what I could gather, the dartlang team said that it is "impossible" for them to fix this, I am not an experienced dev and I don't need to be in order to know that that is not true, since other modern languages don't have this problem.

I would agree that this is indeed an unpleasant usability issue for the debugger. I don't see any reason though why we would not be able to make this work in common situations given that we should be able to peek through future chains.
In the code below:
import 'dart:async';

Future<void> baz() async {
  await null;
  throw 'A';
}

Future<int> bar() => baz().then((value) => 10);

Future<int> foo() async {
  try {
    await bar();
  } catch (e) {}
  return 0;
}

void main(List<String> arguments) async {
  await foo();
}

Debugger stops at throw as if it is uncaught.
We also get a really weird truncated lazy async stack trace with no position information in the last frame (/cc @mkustermann @cskau-g):
$ out/ReleaseX64/dart /tmp/uncaught.dart
#0      baz (file:///tmp/uncaught.dart:5:3)
<asynchronous suspension>
#1      bar.<anonymous closure> (file:///tmp/uncaught.dart)
<asynchronous suspension>

Reason for truncation is probably usage of legacy baz().then((value) => 10 instead of value = await baz(); return 10. @cskau-g has recently added support for whenComplete() we could possibly extend that to then() as well.
Though generally speaking I think we should encourage users to use await and try/await/catch/finally instead of the pre-async/await then()/catchError()/whenComplete().
Also for certain cases it's not possible to select the right way to unwind, because a future can have multiple listeners, which would yield a back trace tree instead of a stack. We could possibly print an the tree, but that would bring in a whole lot of new issues (e.g. figure out nice way to print such a backtrace tree, making package:stack_trace understand it, ...)

@mkustermann If I replace then with timeout I get correct lazy async stack, but debugger still thinks exception is uncaught. I looked briefly at the code and it seems to attempt to make things work by looking for handler in the "awaiter stack trace" however this code is written in terms of causal stacks and has not been updated to use lazy async stacks at all.
There is a consideration here that there is a lot of legacy code (written without async/await) and code written in mixed style - sometimes hidden inside SDK libraries and packages which user did not author. I think we should definitely make things work for Future helper methods whenever we can (e.g. it is a bit puzzling that it would work for timeout but not catchError (BTW, replacing then with catchError produces somewhat garbled stack as well).

Slightly related - this comes up quite a bit in the Dart-Code issue tracker, and I've generally been encouraging people to use try/catch where possible to avoid it (although often they're calling libraries that they can't easily modify), though some examples came up where this isn't possible, for example:
return FutureBuilder<Widget>(
  future: f,
  builder: (BuildContext context, AsyncSnapshot<String> snapshot) {
    if (snapshot.hasData) {
      return SuccessfulWidget();
    } else if (snapshot.hasError) {
      return ErrorMessageWidget(snapshot.error);
    }

    return LoadingSpinnerWidget();
  }
);

Here, the code that's handling the error is in FutureBuilder so it can't easily be converted to use try/catch. If I understand the suggestion above of "peeking through future chains", I think that would also handle this (as it's likely the error handler has been attached before the code in the Future throws)?

There a bit of back-and-forth here, but we have no assignee and no clear action items, AFAICT.
@mraleph and/or @mkustermann, can you clarify what we'd like to do on this issue, and whether it's something I need to look into?

Regarding the truncated stack: We can investigate adding support for the legacy Future.then() and Future.catchError() APIs as part of the existing open issue here: https://github.com/dart-lang/sdk/issues/40815

@cskau-g Could you investigate the uncaught error reporting functionality - both when it is actually caught (as this issue) as well as reporting exceptions as uncaught if the handler was specially marked (see https://github.com/flutter/flutter/issues/17007)

@cskau-g @mkustermann Any update?

@cskau-g @mkustermann Any update?

@cskau-g has landed changes on our side. The ball is now in Flutter court.

@cskau-g has landed changes on our side. The ball is now in Flutter court.

@mraleph are the changes different to the ones in #17007? Although this sounds like the same issue, I believe it's actually the opposite problem.
#17007 is about exceptions that Flutter is catching, but are logically uncaught (eg. expected behaviour is for the debugger to break).
This issue is about exceptions that are being caught (eg. with .catchError()) but the debugger considers uncaught (because there's no catch in the stack?) and therefore result in the debugger breaking (making the user believe there is an unhandled error they need to do something about), but clicking Continue results in the app continuing to work as expected.

@mraleph are the changes different to the ones in #17007? Although this sounds like the same issue, I believe it's actually the opposite problem.
#17007 is about exceptions that Flutter is catching, but are logically uncaught (eg. expected behaviour is for the debugger to break).
This issue is about exceptions that are being caught (eg. with .catchError()) but the debugger considers uncaught (because there's no catch in the stack?) and therefore result in the debugger breaking (making the user believe there is an unhandled error they need to do something about), but clicking Continue results in the app continuing to work as expected.

My mistake, yeah it is a separate issue. I got confused.

My mistake, yeah it is a separate issue. I got confused.

@mraleph I am assigning P2 for this.  Please change if you think it has a different priority.

@mraleph I am assigning P2 for this.  Please change if you think it has a different priority.

Update on the various issues that have been discussed above:

Future.then() and Future.catchError() support has been added in 8f2c47f (see #40815).
VM annotation (@pragma('vm:notify-debugger-on-exception')) has been added to pause the debugger on otherwise caught exceptions (see #17007).
With support for Future.then() and Future.catchError(), the debugger pausing mechanism now correctly identifies the cases for which this issue was originally created. This means 8f2c47f indirectly fixes this issue.

Update on the various issues that have been discussed above:

Future.then() and Future.catchError() support has been added in 8f2c47f (see #40815).
VM annotation (@pragma('vm:notify-debugger-on-exception')) has been added to pause the debugger on otherwise caught exceptions (see #17007).
With support for Future.then() and Future.catchError(), the debugger pausing mechanism now correctly identifies the cases for which this issue was originally created. This means 8f2c47f indirectly fixes this issue.

@cskau-g should these changes consider the following as caught?
Future<void> main() async {
  await throwAsync().catchError((e) => print('Caught the error!'));
}

Future<void> throwAsync() async {
  await Future.delayed(const Duration(milliseconds: 100));
  throw 'a';
}

I tested this with the latest nightly built from 990b03290f0b889c33668d91c8043abb55555476 but the debugger still pauses on the throw.

@cskau-g should these changes consider the following as caught?
Future<void> main() async {
  await throwAsync().catchError((e) => print('Caught the error!'));
}

Future<void> throwAsync() async {
  await Future.delayed(const Duration(milliseconds: 100));
  throw 'a';
}

I tested this with the latest nightly built from 990b03290f0b889c33668d91c8043abb55555476 but the debugger still pauses on the throw.

@DanTup The fix unfortunately got reverted since it happened to trigger an unrelated issue in internal tests.
I've just landed a fix for the second issue and relanded the original fix, so we should be back to it all working again.
I'll close this issue now, but if you continue experiencing issues even after this fix has re-rolled, please do reopen.

@DanTup The fix unfortunately got reverted since it happened to trigger an unrelated issue in internal tests.
I've just landed a fix for the second issue and relanded the original fix, so we should be back to it all working again.
I'll close this issue now, but if you continue experiencing issues even after this fix has re-rolled, please do reopen.

@cskau-g using the latest nightly I'm still seeing the debugger break on the exception in the code sample above.
The SDK version is:
Dart SDK version: 2.12.0-edge.073f792b599b00a088f640e5dfa658ab3f5c90e4 (be) (Tue Jan 19 16:47:32 2021 +0000) on "macos_x64"
from http://gsdview.appspot.com/dart-archive/channels/be/raw/latest/sdk/

@cskau-g using the latest nightly I'm still seeing the debugger break on the exception in the code sample above.
The SDK version is:
Dart SDK version: 2.12.0-edge.073f792b599b00a088f640e5dfa658ab3f5c90e4 (be) (Tue Jan 19 16:47:32 2021 +0000) on "macos_x64"
from http://gsdview.appspot.com/dart-archive/channels/be/raw/latest/sdk/

I've verified that there is indeed an issue with debug breaking on .catchError, which is unrelated to the CL for stack unwinding.
Looks like we'll need some additional logic in Debugger::ShouldPauseOnException to handle when the catchError isn't part of the stack but rather the future being awaited.

I've verified that there is indeed an issue with debug breaking on .catchError, which is unrelated to the CL for stack unwinding.
Looks like we'll need some additional logic in Debugger::ShouldPauseOnException to handle when the catchError isn't part of the stack but rather the future being awaited.

@cskau-g What is the status on this?
If we can land this in tomorrow (your time), it is likely to make the January milestone.
Otherwise, please comment if this need to be cherrypick for January or we should move to a later milestone.

@cskau-g What is the status on this?
If we can land this in tomorrow (your time), it is likely to make the January milestone.
Otherwise, please comment if this need to be cherrypick for January or we should move to a later milestone.

@franklinyow The plan was to land this yesterday, but the change is unfortunately still in review.
I'll try get it pushed through today.

@franklinyow The plan was to land this yesterday, but the change is unfortunately still in review.
I'll try get it pushed through today.

mraleph and I agreed to push this off this milestone to avoid rushing the change in, seeing how it's already gotten reverted twice.
The follow-up fix for the .catchError will likewise not be in this milestone.

mraleph and I agreed to push this off this milestone to avoid rushing the change in, seeing how it's already gotten reverted twice.
The follow-up fix for the .catchError will likewise not be in this milestone.

With dfd5413 the last piece of the puzzle should now be in place.
Closing this issue here. But as always, feel free to reopen if you encounter any further issues with the above cases.
Thank you.

@cskau-g seems to work great, thank you!

hey sorry for a newbie question but do you have any idea when will flutter be built with this fix ? or how can I check it ?

@DanTup I tried with dev channel of Flutter but it seems the issue is still here.
Maybe last flutter dev build doesn't use last dart sdk dev which includes the fix ?

@kevinmarrec dev contains dfd5413. Could you describe the issue you are seeing in more details? We added support for .then and .catchError for futures, but it might be that we are still missing support for some other pattern (we are playing a bit of whack-a-mole here).

When debugging this code on VS Code (F5) with only Uncaught Exceptions checked :
import 'package:http/http.dart' as http;

Future<void> main() async {
  try {
    await http.get(Uri.parse('www.fail.com'));
  } catch (err) {
    debugPrint('Error caught');
  }
}

VS Code still breaks (breakpoint) in third party (http here) cause it thinks the error hasn't been caught, but I do (catch) :

Using catchError doesn't work as well :
import 'package:http/http.dart' as http;

Future<void> main() async {
  http.get(Uri.parse('www.fail.com')).catchError((error) {
    debugPrint('Error caught');
  });
}

Yeah, I can see it does not work. It seems if you have more than one Future in the chain things break.
import 'package:http/http.dart' as http;

Future<void> throwAsync() async {
  await Future.delayed(const Duration(milliseconds: 100));
  throw 'Throw from throwAsync!';
}

Future<void> foo() async {
  await Future.delayed(const Duration(milliseconds: 100));
  await throwAsync();
}

Future<void> main() async {
  try {
    await throwAsync();  // Ok.
  } catch (err) {
    print('Error caught');
  }
  try {
    await foo();  // Not okay.
  } catch (err) {
    print('Error caught');
  }
}

@mraleph Good catch !
I can indeed confirm it breaks when there's more than one Future in the chain.
It will be my pleasure to try again when there's a fix coming up :)
And it would be awesome if it got fixed before next Dart release lands :)

I'll have a look.

Sorry for asking an obvious question here. When can we get this fix included in dart sdk for fluttter?
AFAIK, we cannot specify a dart sdk version with flutter sdk (https://stackoverflow.com/a/51514523/4700001).

@namchuai I think we need to wait Dart 2.13 release and then most probably Flutter 2.1 will feature Dart 2.13

@namchuai to expand on @kevinmarrec response. Dart's master branch is automatically continuously being rolled into Flutter's master branch. So if you are using master channel then you should already have a fix included (unfortunately at the moment that is the only channel of Flutter that includes the fix). All other branches are entirely aligned as well (e.g. beta channel of Flutter uses beta channel of Dart and the same for stable channel). Except for very serious bugs (e.g. crashes) there is no way to expedite this process - it happens at a fixed cadence.

Still getting this issue
I have some code like this:
try {
      await calculator.connectToServer().timeout(Duration(milliseconds: 15000));
} on TimeoutException catch (_) {
     print("Timeout of 15000 ms exceeded trying to connect to server");
     return ServerOffScreen(_login);
}

and everytime a TimeoutException is thrown, VSCode is blocking on the TimeoutException
I use
Flutter 2.2.0 • channel beta • https://github.com/flutter/flutter.git
Framework • revision b22742018b (3 weeks ago) • 2021-05-14 19:12:57 -0700
Engine • revision a9d88a4d18
Tools • Dart 2.13.0

Still having this issue with 3rd party package (flutterchina/dio)
$ flutter --version
Flutter 2.5.3 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 18116933e7 (4 weeks ago) • 2021-10-15 10:46:35 -0700
Engine • revision d3ea636dc5
Tools • Dart 2.14.4

@a7md0 please file a new issue and provide a reproduction. just saying "Still having this issue" is unactionable for us.

@a7md0 please file a new issue and provide a reproduction. just saying "Still having this issue" is unactionable for us, because we have fixed all cases we could reproduce - so your issue is likely something else.

#47692

authors: DanTup Kenji-K a7md0 bwilkerson cosinus84 cskau-g edvinasgestautas franklinyow kevinmarrec mehdiRezzagHebla mkustermann mraleph namchuai ramsestom


text:
Cannot return this in async method when this could be coerced to a typedef.

Dart SDK Version (dart --version)

Dart VM version: 2.4.1 (Wed Aug 7 13:15:56 2019 +0200) on "macos_x64"
Description
The following code works fine:
typedef Go = void Function(String name);

class CanGo {

  void call(String name) => print("Hello $name");

  Future<Go> next() {
    return Future.value(this);
  }
}

main() {
  Go go = CanGo();
  print("Going alright!");
  go("joe");
}

But if I change the next method to this:
  Future<Go> next() async {
    return this;
  }

which should be equivalent?... I get an error:
The return type 'CanGo' isn't a 'Future<void Function(String)>', as defined by the method 'next'.

Expected result
The two different implementations of next seem equivalent, however only the first one "compiles" (according to the Dart Analyser).
Ok:
  Future<Go> next() {
    return Future.value(this);
  }

Not ok:
  Future<Go> next() async {
    return this;
  }

I am currently working around the issue by adding an "alias" to this:
  Go get self => this;

  Future<Go> next() async {
    return self;
  }

But would be nice to not have such an inconsistency in the language.

Seems like the analyzer forgets to do implicit call method tear-off when the value is this. It works correctly on the common front-end.

Analyzer is now ok with this code.

authors: lrhn renatoathaydes srawlins


text:
Analyzer allows null to be assigned to Never

The following code should be an error in an opted in library: the analyzer reports no errors.
Never x = throw "error";
void foo() {
   x = null;
 }

Tested in tests/language/nnbd/never/never_null_assignability_strong_test.dart landed in https://dart-review.googlesource.com/c/sdk/+/143040 .

https://dart-review.googlesource.com/c/sdk/+/144811

authors: leafpetersen scheglov


text:
Stream.listen() ignores cancelOnError argument

Hi,
Recently I have been setting up an async generator function for testing some functionality.
My goal was to test how to make sure that a stream I listened to, doesn't finish after an exception.
To make this work, we have the cancelOnError argument of the Stream<T>.listen() method.
Turns out that setting this option to false, still terminates the stream after the first exception.
I tested this both with a Flutter (w/ v1.17.3) app and on Dartpad (w/ Dart 2.8.4), although this seems purely related to Streams and not Flutter.
TLDR: To me it looks like the argument is ignored althogether, since both true and false yield the same result (excuse the pun).
Example:
void main() {
  myStream().listen((value){
    print(value);
  },onError: (e){
    print(e);
  }, cancelOnError: false);
}

Stream<String> myStream() async* {
  for (int i = 0; i < 5; i++) {
    if(i == 2){
      throw Exception("some error");
    }else {
      yield "$i";
    }
  }
}

Expected output:
0
1
Exception: some error
3
4

Actual output:
0
1
Exception: some error

This is working as intended.
If you add an onDone: () { print("done"); } listener too, you'll see a difference between cancelOnError being true or false.
The problem is not the listen call, but that all async* methods end when they throw an exception. When myStream throws Exception("some error"), that breaks the loop and ends the method body. At that point, there is no way for that stream to emit any further events, it has left the function body which could do that, so the stream is closed.
A throw does not emit an error directly, because if it did, you wouldn't be able to catch it.
Dart async* methods are simply not built to emit errors mid-stream.
The yield statement can only emit events, and throwing will end the body before that error is emitted (unless  you catch it, and then nothing happens). There is no yield throw error; to emit an error directly (and it hasn't been a much requested feature, so it's way down our priorities list to add something like that).
You actually can emit an error mid-stream, but you have to be a little clever;
  yield* Stream.error(Exception("some error"), StackTrace.current);

This creates a stream which emits a single error, then uses yield* to emit all its events on the current stream. That works for error events too.

authors: lrhn navaronbracke


text:
Failures on [ package:dds ] Add IPv6 support; 1.3.2 release

There are new test failures on [ package:dds ] Add IPv6 support; 1.3.2 release.
The tests
pkg/dds/test/sse_smoke_test RuntimeError (expected Pass)

are failing on configurations
unittest-asserts-release-mac

Log: https://dart-ci.appspot.com/log/pkg-mac-release/unittest-asserts-release-mac/13725/pkg/dds/test/sse_smoke_test

Reverted in https://dart-review.googlesource.com/c/sdk/+/161450

authors: bkonyi zichangg


text:
[analyzer] Implement non-function type aliases

This is the analyzer specific issue for https://github.com/dart-lang/language/issues/115. Note that this includes the following elements (with check boxes on dart-lang/language#115):

analysis_server core features (Go To Definition, Find References, Sort Declarations)
analysis_server auto-complete (name, constructors)
analyzer: include generalized type alias test cases in existing diagnostic tests (invalid assignment, type alias application in places like catch, extends, constructor redirection, unnecessary cast with as, unused type aliases, invalid access to a @Protected constructor, member, etc)
linter: consider existing lints; add test cases and application to generalized type alias

@scheglov, can we close this one? How about the sub items in https://github.com/dart-lang/language/issues/115 under 'analyzer' that we got from @srawlins?

Note that the implementation tracking issue for non-function type aliases is now https://github.com/dart-lang/sdk/issues/44951. The sub-items I mentioned here are now separate items.

@srawlins is going over the analyzer tests and adds necessary new tests. I guess we will close this issue only after finishing this tests work. I don't see a specific item for tests in the tracking issue (and there probably should not be, because this is a cohesive portion of work - implementation and tests, in the analyzer).

OK, thanks! There is an item for co19 tests (https://github.com/dart-lang/sdk/issues/44964), and there is an item for checking that the existing language tests are passing (https://github.com/dart-lang/sdk/issues/44966), and I think it makes sense to keep track of the analyzer specific tests separately.

Hi @TimWhiting, the ability of a code generator to work with new language constructs is separate from the support for the same language construct in the analyzer and compilers. I wouldn't expect the package freezed to handle that kind of type alias at this point, that would most likely be a new feature to implement in the code generator when it is enabled by default.
Moreover, I do not think dart run (or pub run) supports enabling an experiment for subprocesses. The package build does have something called withEnabledExperiments which can be used by a Builder. I haven't tried to use that feature, so I don't know exactly what it can do or how to use it, but I believe that it would be a feature of the freezed code generator, not something which is enabled from the outside when that code generator is executed.

Got it. But with TypeAliases it doesn't matter if the generators use the typedef PlayerID or the real type String and most of the generators already handle function typedefs so I assumed the code would at least be generated.
This command: dart run build_runner build --enable-experiment=nonfunction-type-aliases got me past the error and let me generate the code. In reality the generators printed the String rather than the typedef, but that shouldn't matter right now.
I'll submit an issue on package:build to consider using the enabled experiments in analysis_options.yaml rather than needing to pass it in on the commandline.

OK, sounds good! Other than that, non-function type aliases are about to be released soon, so there should not be a need to enable an experiment by then.

@eernstg Who should own this?

@scheglov, you wanted to keep this issue open until some test related tasks were completed, right?

IIRC, @srawlins wanted to add more test cases. If this is done, then I'm not aware about more work to do.
For lints @pq might have ideas.

I've just changed the summary of this issue to include check boxes. I've checked them all except the linter one. @pq should that just be split into a new issue at the linter repo?

SGTM @srawlins.  Better to track on the linter repo.  Thanks!

I'm going to close this item as complete. @pq, can you file a tracking issues in the linter for the remaining work, and add it as an item for the overall meta language impl. issue (https://github.com/dart-lang/sdk/issues/44951)? Thanks! We might want to call out whether you find that the linter work is / isn't blocking for the release.

authors: TimWhiting devoncarew eernstg franklinyow pq scheglov srawlins