Dart 类JsObject没有构造函数jsify
我正在尝试使用Dart执行一个地图示例。但是我犯了个错误 类JsObject没有构造函数jsify 我使用的dart代码是Dart 类JsObject没有构造函数jsify,dart,dart-editor,Dart,Dart Editor,我正在尝试使用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 globa
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]);
}
公共规范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"
name:google\u maps\u api\u with\u dart\u js
描述:使用JavaScript显示位置的应用程序
使用dart:js库调用的GoogleMapsAPI。
依赖项:
浏览器:“>=0.9.0=0.8.10+6我通过切换到新版本解决了这个问题
Dart编辑器版本1.0.0_r30188(稳定)
Dart SDK版本1.0.0.3_r30188
现在一切都好了
谢谢!我通过切换到新版本解决了这个问题
Dart编辑器版本1.0.0_r30188(稳定)
Dart SDK版本1.0.0.3_r30188
现在一切都好了
谢谢!您的SDK版本是什么?我没有发现最近的错误。我无法用最新的SDK重现问题。它对我正常工作。我正在使用Dart编辑器版本0.8.1\u r28355 Dart SDK版本0.8.1.2\u r28355现在,我将更新我的Dart版本,看看这是否解决了我的问题。您的SDK版本是什么?我想知道不要在最近的版本上出错。我无法用最新的SDK重现该问题。它对我正常工作。我正在使用Dart编辑器版本0.8.1_r28355 Dart SDK版本0.8.1.2_r28355。现在,我将更新我的Dart版本,看看这是否解决了我的问题。