Import and make use of Polymer-Dart 1.0.0 release

2020-06-24 08:02发布

问题:

I do love Polymer - and I do love Dart. And the Polymer-Dart library was pretty much the best thing ever happend to Web development (imho).

Polymer 1.0 has been released a while ago and Googlers are working hard to build the corresponding Dart wrapper as stated in Dart's Web Development Google Group.

I've built a fairly huge project quite a while ago in Polymer 0.5 and it's time to upgrade. Due to various changes in Polymer 1.0 the migration is quite hard and a lot of code breaks are expected. Since Polymer 1.0 is meant to build the final API structure for future releases, I decided to start from scratch and build the project in Polymer 1.0. Right now, there is no official 0.17 Polymer-Dart wrapper released, which is why I want to make use of the developement branch '0.17-0-dev-interop-reverse'.

However, right now, I am wondering, how to actually import the Polymer-Dart dev project into my Polymer Dart project. I am using Webstorm 10 and Dart 1.11.3.

Also, what is currently not supported by the development version? I read somewhere that it's missing a transformer - is that still the case?

My question is basically, how to use Polymer 1.0 in Dart already without waiting for the official 0.17 release.

回答1:

With the following pubspec.yaml it works fine for me:

Dart Polymer 1.0.0-rc.2

name: todomvc
description: TodoMVC built with the polymer.dart package
version: 0.15.1
dependencies:
  browser: any
  polymer: 1.0.0-rc.2
  polymer_elements: 1.0.0-rc.2
  reflectable: 0.3.2
  web_components: ^0.12.0

transformers:
- web_components:
    entry_points:
    - web/index.html
    - test/listorder_test.html
    - test/markdone_test.html
    - test/mainpage_test.html
- reflectable:
    entry_points:
    - web/index.dart
    - test/listorder_test.dart
    - test/markdone_test.dart
    - test/mainpage_test.dart
- test/pub_serve:
    $include: test/**_test{.*,}.dart
- $dart2js:
    minify: true

environment:
  sdk: ">=1.2.0 <2.0.0"

There is an TodoMVC application ported to Polymer.dart 0.17 (see the branches polymer-0.17 and polymer-0.17-behaviors.