As part of releasing Dart 2, we will be enabling --preview-dart-2 by default in our dev channel releases. This may cause some breakages due to stricter Dart type enforcement.
The change will land soon in the Dart 2 dev channel.
Keep reading to understand how this may affect your code and how to address issues.
In February, the Dart team announced Dart 2, and we offered steps to preview Dart 2 features via the --preview-dart-2 flag. We are now ready to enable this flag by default. If you have not already tested your apps and packages with this flag, please do so now to see if you are impacted.
Changes to Dart 2’s type system include a compile-time and runtime checks.
The Dart Analyzer has already been enforcing Dart 2 compile-time checks for some time, so we don’t anticipate any significant breakages.
The Dart Dev Compiler (DDC) and Flutter have been enforcing Dart 2 runtime checks, so code that has been run and tested with these tools should also seen few issues.
You may, however, see new errors as we are enable runtime checks in the Dart VM and dart2js.
Check out the documentation on fixing common type problems. It includes a number of examples and suggested fixes.
Read the recently updated Effective Dart guide, especially the section on Types.
Review the Dart 2 migration guide.
Post questions on Stack Overflow. We review items tagged with "dart" regularly.
Find Dart on Gitter.
See the other resources on the Dart community page.
A reply will be posted to this thread when the release has landed.
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+uns...@dartlang.org.
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/13b39623-f197-4a60-a875-a1b1ff032176%40dartlang.org.
Ping?On Thu, May 31, 2018 at 12:41 PM Natalie Weizenbaum <nw...@google.com> wrote:What does "land soon" mean?
How long do users have to get their packages working in Dart 2 mode?
How do users ensure their code will be compatible with Dart 2 mode? The Dart 2 migration guide doesn't mention anything about --preview-dart-2. How can a user run all their package's tests in Dart 2 mode?
To view this discussion on the web visit https://groups.google.com/a/dartlang.org/d/msgid/misc/CAKDS1k5SXT4-BVNm%2BhKGfw7YuRMyQiW_UbNrVUhqCJ8kbjW6EA%40mail.gmail.com.
On Thu, May 31, 2018 at 12:41 PM Natalie Weizenbaum <nw...@google.com> wrote:What does "land soon" mean?I think the goal is this week.
How long do users have to get their packages working in Dart 2 mode?
As long as they are willing to hold off updating to the next drop of the SDK. For at least a while it should also be possible to run with `DART_VM_OPTION=--no-preview-dart-2` to get the latest SDK but keep using Dart 1 runtime semantics in the VM.
How do users ensure their code will be compatible with Dart 2 mode? The Dart 2 migration guide doesn't mention anything about --preview-dart-2. How can a user run all their package's tests in Dart 2 mode?
Might be an oversight of the migration guide but for VM tests the approach is `DART_VM_OPTIONS=--preview-dart-2 pub run test`. For dart2js tests the approach is adding `--preview-dart-2` to the dart2js_args in `build.yaml` and running tests with `pub run build_runner test -- -p chrome`. I don't _think_ `pub run test` supports passing flags to dart2js.
I think the pattern we expect most projects to take is - upgrade to the latest SDK, try to run tests, fix failures. As an escape hatch to get unblocked the fallbacks are `--no-preview-dart-2` or downgrading to an older SDK.