Giter Site home page Giter Site logo

Comments (8)

harsuu942 avatar harsuu942 commented on August 21, 2024 1

Thanks a man !!! I got the solutions.

from dart-google-maps.

a14n avatar a14n commented on August 21, 2024

Did you correctly include the Maps API JavaScript using a script tag before your dart script ?

<script src="https://maps.googleapis.com/maps/api/js?key=API_KEY"></script>

from dart-google-maps.

harsuu942 avatar harsuu942 commented on August 21, 2024

Yes, I have already included the API javaScript but still showing TypeError.

from dart-google-maps.

a14n avatar a14n commented on August 21, 2024

It looks like an issue with the html setup. Do you have something similar to https://github.com/a14n/dart-google-maps/blob/master/example/01-basics/map-simple/map.html ?

Could you post your html code?

from dart-google-maps.

harsuu942 avatar harsuu942 commented on August 21, 2024

Here is my HTML code.

<title>web</title> <style> html, body, #map { height: 100%; margin: 0px; padding: 0px } </style>
<script src="https://maps.googleapis.com/maps/api/js?key=googleAPIKey"></script> <script defer src="page.dart.js"></script>

from dart-google-maps.

a14n avatar a14n commented on August 21, 2024

Hard to tell what is wrong without additional informations. If you have a like to a public repo I could access I can take a look but for now I can't help more.

from dart-google-maps.

harsuu942 avatar harsuu942 commented on August 21, 2024

The sample example is working fine but I want to use it as a widget.

Here is what I used as a widget

Widget getMap() {
String htmlId = "map";

// ignore: undefined_prefixed_name
ui.platformViewRegistry.registerViewFactory(htmlId, (int viewId) {
final myLatlng = LatLng(1.3521, 103.8198);

final mapOptions = MapOptions()
  ..zoom = 10
  ..center = LatLng(1.3521, 103.8198);

final elem = DivElement()
  ..id = htmlId
  ..style.width = "100%"
  ..style.height = "100%"
  ..style.border = 'none';



final map = GMap(elem, mapOptions);

Marker(MarkerOptions()
  ..position = myLatlng
  ..map = map
  ..title = 'Hello World!'
);

return elem;

});

return HtmlElementView(viewType: htmlId);
}

This time getting error: "TypeError: Cannot read property 'maps' of undefined" so can't use as a widget
so could please help me out.

from dart-google-maps.

a14n avatar a14n commented on August 21, 2024

Hard to tell what is wrong. You can take a look at how google_maps_flutter_web works.

from dart-google-maps.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.