Dart 2 migration guide for web apps

    See also:

    The development environment for web apps is different in Dart 2 from Dart 1.x.Here are the highlights:

    • HTML files with <script src="foo.dart"…> elements,such as . See details below.
    • Dart code, due to changes in the

    For complete examples of migrated apps, compare the 4.x and master branchesof any one of the angular-examples apps, such as these:

    Make these changes to your pubspec.yaml file:

    • Add new dev_dependencies:
      • build_runner:
      • build_test: , if you are running tests
      • build_web_compilers:
    • Drop dev_dependencies:
    • Upgrade to test version 0.12.30 or later; it runs Chrome tests headless by default.
    • Drop all transformers:
      • angular
      • dart_to_js_script_rewriter
      • test/pub_serve

    HTML with script elements

    The most common example of a file with <script> elements is web/index.html.You’ll need to make these changes:

    • Drop <script defer src="packages/browser/dart.js"></script>
    • Replace <script defer src="foo.dart" type="application/dart"></script> by
    • Dart 2 Updates:Information about changes in Dart 2, and how to migrate your code from Dart 1.x.