1

Dart を使用してマップの例を実行しようとしています。しかし、エラーが発生しています クラス JsObject にはコンストラクター jsify がありません 私が使用している dart コードは

library google_maps;

import 'dart:html' show query;
import 'dart:js' show context, JsObject;

void main() {
  // The top-level getter context provides a JsObject that represents the global
  // object in JavaScript.
  final google_maps = context['google']['maps'];

  // new JsObject() constructs a new JavaScript object and returns a proxy
  // to it.
  var center = new JsObject(google_maps['LatLng'], [-34.397, 150.644]);

  var mapTypeId = google_maps['MapTypeId']['ROADMAP'];

  // new JsObject.jsify() recursively converts a collection of Dart objects
  // to a collection of JavaScript objects and returns a proxy to it.
  var mapOptions = new JsObject.jsify({
      "center": center,
      "zoom": 8,
      "mapTypeId": mapTypeId
  });

  // Nodes are passed though, or transferred, not proxied.
  new JsObject(google_maps['Map'], [query('#map-canvas'), mapOptions]);
}

pubspec.yaml は

name: google_maps_api_with_dart_js
description: An app that displays a location using the JavaScript
    Google Maps API that is called using the dart:js library.
dependencies:
  browser: ">=0.9.0 <0.10.0"
environment:
  sdk: ">=0.8.10+6 <2.0.0"
4

1 に答える 1

1

新しいバージョンに移行することでこれを解決しました

Dart Editor バージョン 1.0.0_r30188 (STABLE) Dart SDK バージョン 1.0.0.3_r30188

今ではすべて正常に動作しています。

ありがとうございました!

于 2013-12-05T12:57:35.847 に答える