Skip to content

dart:async is optional in Flutter but not in the 2.0.0 SDK #34972

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
johnpryan opened this issue Oct 29, 2018 · 3 comments
Closed

dart:async is optional in Flutter but not in the 2.0.0 SDK #34972

johnpryan opened this issue Oct 29, 2018 · 3 comments
Labels
legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@johnpryan
Copy link
Contributor

The 2.0.0 analyzer will catch usages of dart:async that are missing an import, but the Dart SDK provided by Flutter seems to allow it. This forces users to switch back and forth between SDKs when developing for Flutter and web

  • Dart VM version: 2.0.0 (Fri Aug 3 10:53:23 2018 +0200) on "macos_x64"
  • MacOSX
@lrhn lrhn added the legacy-area-analyzer Use area-devexp instead. label Oct 30, 2018
@lrhn
Copy link
Member

lrhn commented Oct 30, 2018

In Dart 2.1, the dart:core library started exporting Future and Stream. Since you can write functions returning Future or Stream without importing dart:async (by using async or async* function bodies), we decided that you should be able to write the type of those functions too without having to import dart:async.

It does mean that any code using that feature should have an SDK requirement of 2.1.0.
The Flutter project has been releasing development versions of the Dart SDK, so they already have the feature, while the stable Dart 2.1 release hasn't been made yet.

(Analyzer people, would it make sense to detect uses of Future and Stream without an import when a package has an SDK requirement <2.1.0?)

@stereotype441
Copy link
Member

Related: #34978.

@stereotype441 stereotype441 added the P2 A bug or feature request we're likely to work on label Oct 30, 2018
@srawlins srawlins added the type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) label Nov 16, 2021
@srawlins
Copy link
Member

I'll close this as stale.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-analyzer Use area-devexp instead. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

4 participants