2016-07-09 17 views
1

exampleの後にpubspect.yamlの違いを除いて、これを実行しようとしています。すなわち、例のリンクに見られるように、反射は0.1.4の代わりに0.2.0である必要があります。nullオブジェクトにメソッドがありません[] =

すべてがうまくコンパイルされます。しかし、私はランタイムエラーが発生します。私はDartiumブラウザで次のエラーを取得するライン25で

https://github.com/dart-lang/polymer-dart/blob/behaviors/lib/init.dart

:私は、次のファイルにそれをトレースし

The null object does not have a method '[]='. 

NoSuchMethodError: method not found: '[]=' 
Receiver: null 
Arguments: ["push", Closure: (List, Iterable) => dynamic] 
#0  Object._noSuchMethod (dart:core-patch/object_patch.dart:42) 
#1  Object.noSuchMethod (dart:core-patch/object_patch.dart:45) 
#2  _setUpListMethods (package:polymer/init.dart:25:14) 
#3  initPolymer.<initPolymer_async_body> (package:polymer/init.dart:17:3) 
#4  _RootZone.runUnary (dart:async/zone.dart:1204) 
#5  _FutureListener.handleValue (dart:async/future_impl.dart:131) 
#6  _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:637) 
#7  _Future._propagateToListeners (dart:async/future_impl.dart:667) 
#8  _Future._completeWithValue (dart:async/future_impl.dart:477) 
#9  _Future._asyncComplete.<anonymous closure> (dart:async/future_impl.dart:528) 
#10  _microtaskLoop (dart:async/schedule_microtask.dart:41) 
#11  _startMicrotaskLoop (dart:async/schedule_microtask.dart:50) 
#12  _ScheduleImmediateHelper._handleMutation (dart:html:49308) 

マイpubspec.yaml

name: myproject 
dependencies: 
    polymer: ^1.0.0-rc 
    web_components: ^0.12.0 
    browser: ^0.10.0 
    reflectable: ^0.2.0 
transformers: 
- reflectable: 
    entry_points: 
    - web/main.dart 
environment: 
    sdk: ">=1.2.0 <2.0.0" 

dependency_overrides: 
    polymer: 
    git: 
     ref: behaviors 
     url: https://github.com/dart-lang/polymer-dart.git 
    polymer_interop: 
    git: 
     ref: 0.2.0-dev 
     url: https://github.com/dart-lang/polymer_interop.git 

pubspec.lock

# Generated by pub 
# See http://pub.dartlang.org/doc/glossary.html#lockfile 
packages: 
    analyzer: 
    description: 
     name: analyzer 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.26.4" 
    args: 
    description: 
     name: args 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.13.4+2" 
    async: 
    description: 
     name: async 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.11.0" 
    barback: 
    description: 
     name: barback 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.15.2+8" 
    boolean_selector: 
    description: 
     name: boolean_selector 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.0.2" 
    browser: 
    description: 
     name: browser 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.10.0+2" 
    charcode: 
    description: 
     name: charcode 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.1.0" 
    cli_util: 
    description: 
     name: cli_util 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.0.1+2" 
    code_transformers: 
    description: 
     name: code_transformers 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.2.11" 
    collection: 
    description: 
     name: collection 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.9.0" 
    convert: 
    description: 
     name: convert 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "2.0.0" 
    crypto: 
    description: 
     name: crypto 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "2.0.1" 
    csslib: 
    description: 
     name: csslib 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.13.2" 
    dart_style: 
    description: 
     name: dart_style 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.2.1" 
    glob: 
    description: 
     name: glob 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.1.3" 
    html: 
    description: 
     name: html 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.12.2+2" 
    http_multi_server: 
    description: 
     name: http_multi_server 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "2.0.2" 
    http_parser: 
    description: 
     name: http_parser 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "3.0.2" 
    initialize: 
    description: 
     name: initialize 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.6.1+2" 
    logging: 
    description: 
     name: logging 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.11.3" 
    matcher: 
    description: 
     name: matcher 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.12.0+2" 
    mime: 
    description: 
     name: mime 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.9.3" 
    package_config: 
    description: 
     name: package_config 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.1.5" 
    path: 
    description: 
     name: path 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.3.9" 
    plugin: 
    description: 
     name: plugin 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.1.0" 
    polymer: 
    description: 
     ref: behaviors 
     resolved-ref: "46be7836f387a8a2868507baf61940e871519986" 
     url: "https://github.com/dart-lang/polymer-dart.git" 
    source: git 
    version: "0.17.0-dev" 
    polymer_interop: 
    description: 
     ref: "0.2.0-dev" 
     resolved-ref: cbef534ef5d0839beeeb63f7c25f502df7e79377 
     url: "https://github.com/dart-lang/polymer_interop.git" 
    source: git 
    version: "0.2.0" 
    pool: 
    description: 
     name: pool 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.2.4" 
    pub_semver: 
    description: 
     name: pub_semver 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.3.0" 
    reflectable: 
    description: 
     name: reflectable 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.2.0" 
    shelf: 
    description: 
     name: shelf 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.6.5+2" 
    shelf_static: 
    description: 
     name: shelf_static 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.2.4" 
    shelf_web_socket: 
    description: 
     name: shelf_web_socket 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.2.1" 
    source_map_stack_trace: 
    description: 
     name: source_map_stack_trace 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.0.4" 
    source_maps: 
    description: 
     name: source_maps 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.10.1+1" 
    source_span: 
    description: 
     name: source_span 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.2.3" 
    stack_trace: 
    description: 
     name: stack_trace 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.6.6" 
    stream_channel: 
    description: 
     name: stream_channel 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.5.0" 
    string_scanner: 
    description: 
     name: string_scanner 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.0.0" 
    test: 
    description: 
     name: test 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.12.15+1" 
    typed_data: 
    description: 
     name: typed_data 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.1.3" 
    unittest: 
    description: 
     name: unittest 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.11.6+4" 
    utf: 
    description: 
     name: utf 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.9.0+3" 
    watcher: 
    description: 
     name: watcher 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.9.7+2" 
    web_components: 
    description: 
     name: web_components 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.12.0+4" 
    web_socket_channel: 
    description: 
     name: web_socket_channel 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "1.0.4" 
    when: 
    description: 
     name: when 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.2.0" 
    which: 
    description: 
     name: which 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "0.1.3" 
    yaml: 
    description: 
     name: yaml 
     url: "https://pub.dartlang.org" 
    source: hosted 
    version: "2.1.10" 
sdk: ">=1.17.0-dev.6.2 <1.20.0" 

これまでのところ、私の知る限りです。ここでも、他のすべてのファイルはその例と同じです。

私は依存関係の問題と思われますが、実際に実行するためにここからどこに行くべきかわかりません。このエラーを修正することは可能ですか?

更新context変数配列が存在しないpolymer/init.dartためにsetUpListMethods()に失敗するようだ...私はダーツ-ポリマーがRCにまだある知っているが、私は簡単な例を実行するだろうと思うだろう。私はブレークポイントを作成し、contextがスコープ内に見つかりません。文脈はどこで宣言されていますか?それは依然として依存関係の問題のようなにおいがします。あなたが最近ポリマー1.0.0-rc.xバージョンを使用する場合

+0

がされていないパブの専門家の代わりにpolymer変圧器を追加する必要がありますが、 'polymer:^ 1.0.0-rc'がいくつかのバージョン番号を紛失していると思われます。少なくとも私は 'polymer:^ 1.0.0-rc.17'で全て走っています。他のものについてはプロジェクトで' yaml'を見ています。 https://github.com/dart-lang/polymer-dart/blob/master/pubspec.yaml –

+0

私のプロジェクトは 'dependency_overrides'なしでうまくいきますので、そこにも可能性があります。 –

+0

@JonasBojesen [OK]をクリックすると、さらに詳しいことができます。しかし、 'https:// pub.dartlang.org/packages/custom_element_apigen'を依存関係として追加することはできません。あなたはできる?次のエラーで投稿を更新します – Tek

答えて

2

あなたはreflectableトランス

transformers: 
- polymer: 
    entry_points: 
    - web/index.html 

も参照してくださいhttps://github.com/dart-lang/polymer-dart

+0

問題は私がSymfony2を使用していて、ダーツ' web'のスコープ内にない 'index.html'しかないtwigテンプレートがないことですフォルダ。 – Tek

+1

ポリマーを使用する場合、変圧器が厳密に必要であるようです。 Symfonyのようなフレームワークを使うことはできません.Datコンパイラが認識できないテンプレートでは、Dartがコンパイルを拒否したときに、SymfonyはTwig構文を使用するからです。 SymfonyのアセットURLを管理するには、Twig構文が特に必要です。残念ですが、SymfonyのようなDartとサーバーフレームワークを使用する唯一の方法は、REST API呼び出しによるものです。 – Tek

関連する問題