Comments (8)
Thanks a man !!! I got the solutions.
from dart-google-maps.
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.
Yes, I have already included the API javaScript but still showing TypeError.
from dart-google-maps.
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.
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.
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.
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.
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)
- Remove Polyline from Map HOT 2
- Map view has Infinite Width HOT 1
- Fit bounds doesn't fit properly HOT 4
- Encoding.decodePath throws when running with webdev serve HOT 3
- How to run the demo? HOT 1
- Drawing a layer over part of the map HOT 1
- getPanorama throw a exception when consult not available location for streetview HOT 8
- Multiple Dependency Issue HOT 1
- Google Maps JavaScript API has a new loader, should this lib use it (or expose its API)? HOT 2
- Map not shown in TabBarView after upgrading from flutter version 3.3.10 to 3.7.0 or newer HOT 1
- Using legacy MapLabel JS from flutter application HOT 2
- Migrate to `package:web` HOT 11
- Error with > 7.00 version : Uncaught (in promise) TypeError: Illegal constructor HOT 1
- Finish migrating to wasm-safe JS-interop HOT 18
- Map is correctly displayed but I cannot pan, zoom or anything by default. Is this expected? HOT 1
- Using a GMap from within a material Widget tree? HOT 1
- Implement github actions? HOT 1
- [google_maps] Add AdvancedMarkerElement to resolve deprecation HOT 2
- Support to wasm HOT 12
- AutocompleteSessionToken is wrongly defined HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dart-google-maps.