The class JsObject does not have a constructor jsify

318 views Asked by At

I am trying to execute a map example using Dart. But I am getting an error The class JsObject does not have a constructor jsify The dart code that I am using is

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]);
}

The pubspec.yaml is

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"
1

There are 1 answers

0
user3062106 On

I got this resolved by shifting to new version

Dart Editor version 1.0.0_r30188 (STABLE) Dart SDK version 1.0.0.3_r30188

Now it's all working fine.

Thank you!