a14n / dart-google-maps Goto Github PK
View Code? Open in Web Editor NEWA library to use Google Maps JavaScript API v3 from Dart scripts.
License: Other
A library to use Google Maps JavaScript API v3 from Dart scripts.
License: Other
Can anyone confirm that this plugin still works? I'm trying to make it work here, but it doesn't seem to work...
This problem seems to be closely related to a14n/dart-js-wrapping#8 since the errors are the same.
When including google_maps
and angular2
in the same library, there are many errors like these:
[Error from Dart2JS on angular_maps|web/index.dart]:
packages/google_maps/src/core/mvc/mvcobject.dart:19:3:
External method without an implementation.
external factory _MVCObject();
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I have created a very simple test project to see it in action:
mkdir /tmp/google_maps_angular &&
cd /tmp/google_maps_angular &&
git clone https://github.com/enyo/google_maps_angular.git . &&
pub get &&
pub build
NOTE: the test project uses this dependency override, as suggested in a14n/dart-js-wrapping#8:
# Full pubspec.yaml:
name: angular_maps
dependencies:
google_maps: ^3.1.0
angular2: "2.0.0-beta.22"
dependency_overrides:
source_gen: "^0.5.0"
Any suggestions on how to fix this issue are greatly appreciated!
I have started with the maptype-overlay example and am attempting to access the CoordMapType projection. Simply add, "this.projection;" to the _getTile function. This results in the following error:
Uncaught NoSuchMethodError : method not found: 'projection'
Receiver: Instance of 'Proxy'
Arguments: []
I see the getter on the MapType, so I don't understand why this error occurs.
Or move your source_gen work to master
It'd make it easier to track
I don't know the cause of this. Per the API documentation the callbacks should only accept 2 parameter, but to get the PlacesService to work with textSearch you need to add a 3rd parameter of type JsObject otherwise an exception is thrown.
As i do not know the cause of this (Other than JS tricks from the api that dart compat doesn't support), and it seems highly illogical i won't fix this myself.
for a hotfix
$unsafe.callMethod('textSearch', [jsw.Serializable.$unwrap(request), (js.JsObject results, String status) => callback(jsw.TypedJsArray.$wrapSerializables(results, PlaceResult.$wrap), PlacesServiceStatus.$wrap(status))]);
can be changed to:
$unsafe.callMethod('textSearch', [jsw.Serializable.$unwrap(request), (js.JsObject results, String status, js.JsObject something) => callback(jsw.TypedJsArray.$wrapSerializables(results, PlaceResult.$wrap), PlacesServiceStatus.$wrap(status))]);
Since the upgrade to Dart SDK 24898, a simple instantiation of a Polyline breaks on the setting of the path. For example:
final p = new Polyline(new PolylineOptions()
..path = [new LatLng(52.0, 21.0), new LatLng(52.8, 21.8)]);
issued this following error during data serialization:
Internal error: 'package:js/js.dart': Error: line 961 pos 17: using 'Map' in this context is invalid
if (data is Map) {
How can we solve this? Thanks.
I'm trying to do something similar to this ImageMapType example.
However, when I try to add my ImageMapType
object to the MapTypeRegistry
, it raises this exception: Exception: Error: Expected value implementing google.maps.MapType
.
I'm 100% positive the object passed is a MapType
object, so the error must originate from the wrapped JS.
In my opinion this library would be way more dart-alike if you would use Futures instead of callback functions.
Example of what I have to do:
Future<LatLng> getLatLngFromString(String address) {
var completer = new Completer<LatLng>();
_geocoder.geocode(
new GeocoderRequest()
..address = address,
(results, status) => status == GeocoderStatus.OK
? completer.complete(results[0].geometry.location)
: completer.completeError(
'Geocode was not successful for the following reason: ' +
status.toString()));
return completer.future;
}
It would be better if Futures would be returned directly.
I have a 'CustomMap' class that extend the 'GMap' class.
And i want to access my 'CustomMap ' members and functions through a 'Polyline' that have my 'CustomMap ' as a map.
What i got is "Exception: Class 'GMap' has no instance method 'customFunction' ".
How to reproduce the error :
class CustomMap extends GMap {
void customFunction() {print("custom");}
}
void main(){
CustomMap customMap = new CustomMap(mapDiv);
Polyline polyline = new Polyline()..map = customMap;
print(polyline.map.runtimeType); // got 'GMap' instead of 'CustomMap'
polyline.map.customFunction();// Exception: Class 'GMap' has no instance method 'customFunction'
}
Marker marker = new Marker();
print(marker.get('map') == null); // true
print(marker.map == null);//Exception: The null object does not have a method 'instanceof'
Is it normal that the second way verification doesn't work ?
Hi, me again ...
I thought I let you know that after I downloaded M5 release I get the following errors when I run the unittest case, or any other examples.
FAIL
1 ERROR Expectation: LatLng.toString call js. Caught The null object does not have a method 'callSync'. NoSuchMethodError : method not found: 'callSync' Receiver: null Arguments: [GrowableObjectArray len:0]
Object.noSuchMethod dart:core-patch/object_patch.dart 19:25
_enterScope package:js/js.dart 749:35
_enterScopeIfNeeded package:js/js.dart 728:28
context package:js/js.dart 717:22
maps package:google_maps/google_maps.dart 172:27
LatLng.LatLng package:google_maps/src/core/base/lat_lng.dart 21:55
main.<anonymous closure> http://127.0.0.1:3030/home/nick/dart/dart-google-maps/test/browser_tests.dart 22:24
2 FAIL Expectation: LatLng.equals call js. Caught circular dependency in field initialization
maps package:google_maps/google_maps.dart 172:7
LatLng.LatLng package:google_maps/src/core/base/lat_lng.dart 21:55
main.<anonymous closure> http://127.0.0.1:3030/home/nick/dart/dart-google-maps/test/browser_tests.dart 28:25
3 FAIL Expectation: MVCArray works. Caught The null object does not have a getter 'MVCArray'. NoSuchMethodError : method not found: 'MVCArray' Receiver: null Arguments: []
Object.noSuchMethod dart:core-patch/object_patch.dart 19:25
MVCArray.MVCArray package:google_maps/src/core/mvc/mvc_array.dart 28:72
main.<anonymous closure> http://127.0.0.1:3030/home/nick/dart/dart-google-maps/test/browser_tests.dart 36:26
Total 0 passed, 2 failed 1 errors
You are probably aware but thought I let you know.
Thanks
Nick
I am trying to store LatLng coordinates, but unless I access them instantly, the are null and throw a "Proxy js-ref-7 has been invalidated" execption.
Here is a test:
maptest.html:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>MapTest</title>
<link rel="stylesheet" href="maptest.css">
</head>
<body>
<h1>MapTest</h1>
<div id="gmap" style="width: 500px; height: 500px;"></div>
<script type="application/dart" src="maptest.dart"></script>
<script src="packages/browser/dart.js"></script>
<script src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script src="packages/browser/interop.js"></script>
</body>
</html>
maptest.dart:
import 'dart:html';
import 'dart:async';
import 'package:js/js.dart' as js;
import 'package:google_maps/google_maps.dart';
final LatLng location = new LatLng(-34.397, 150.644);
void main() {
final mapOptions = new MapOptions()
..zoom = 8
..center = location
..mapTypeId = MapTypeId.ROADMAP
;
final map = new GMap(query("#gmap"), mapOptions);
print('Location is $location'); // (-34.397, 150.644)
var timer = new Timer(new Duration(milliseconds: 50), () {
print('Location is $location from timer'); // null
});
}
Output:
Location is (-34.397, 150.644)
Breaking on exception: null
Exception: Proxy js-ref-7 has been invalidated.
Proxy._forward (package:js/js.dart:1037:22)
Proxy.toString (package:js/js.dart:996:15)
LatLng.toString (package:google_maps/src/core/base/lat_lng.dart:27:40)
main.<anonymous closure> (http://127.0.0.1:3030/MapTest/web/maptest.dart:19:45)
As you can see, even a delay of 50 milliseconds is enough to trigger the exception.
I have tested on several version of the maps package, including 1.1.14-dev
Dart SDK and Editor version 0.8.1.2_r28355
Example:
@jsEnum
class MapTypeStyleElementType extends JsEnum {
static final values = <MapTypeStyleElementType>[
ALL,
GEOMETRY,
GEOMETRY_FILL,
GEOMETRY_STROKE,
LABELS,
LABELS_ICON,
LABELS_TEXT,
LABELS_TEXT_FILL,
LABELS_TEXT_STROKE
];
static final ALL = new MapTypeStyleElementType._('all');
static final GEOMETRY = new MapTypeStyleElementType._('geometry');
static final GEOMETRY_FILL = new MapTypeStyleElementType._('geometry.fill');
static final GEOMETRY_STROKE =
new MapTypeStyleElementType._('geometry.stroke');
static final LABELS = new MapTypeStyleElementType._('labels');
static final LABELS_ICON = new MapTypeStyleElementType._('labels.icon');
static final LABELS_TEXT = new MapTypeStyleElementType._('labels.text');
static final LABELS_TEXT_FILL =
new MapTypeStyleElementType._('labels.text.fill');
static final LABELS_TEXT_STROKE =
new MapTypeStyleElementType._('labels.text.stroke');
MapTypeStyleElementType._(o) : super.created(o);
}
I was trying to create a parser for JSON created with https://mapstyle.withgoogle.com/. As the constructor of MapTypeStyleElementType is private there is no possibility (which I found) to find the correct Enum value for a correlating String value. If I have 'geometry' as a String - how do I get the Enum for it?
Can you please give a small example how to call this function from Dart?
Is MarkerClusterer not supported?
https://developers.google.com/maps/documentation/javascript/marker-clustering
Is it possible to add support for this?
I am using your lib version 2.0.3 I have a bug when you invoke
heatmap = new HeatmapLayer(new HeatmapLayerOptions()
..data=pointArray
);
within your workspace work properly but if you created a project using pub.darlang.org package give a error:
error:
Breaking on exception: The null object does not have a method '[]'.
noSuchMethod(Invocation invocation) {
return _noSuchMethod(invocation.isMethod,
_collection_dev.Symbol.getName(invocation.memberName),
invocation._type,
invocation.positionalArguments,
_symbolMapToStringMap(invocation.namedArguments));
I was getting "Uncaught TypeError: undefined is not a function" in my after creating a PlacesService object. After looking carefully on my side, I noticed the same happen in some code examples.
If you take a look at /example/10-places/place-search/page.dart, you'll see that the example is no longer working and the error is thrown (final service = new PlacesService(map); is causing the error asynchronously)
Can you provide an example with polymer.dart. I can't get the map to show within a PolymerElement.
var canvas = getShadowRoot('map-view').querySelector('#map_canvas');
final map = new GMap(canvas, mapOptions);
Hi
Been experimenting with google maps and the app works fine on the desktop. However when I deployed it on a mobile device, map panning does not work. Zooming works and you can pan while two fingers are in contact with the screen (?). Also if the map contains active markers you can not interact with them.
In order to ensure that the problem is not with my code I created few simple examples
Maps as a polymer component https://github.com/nickfloros/ptestmap & deployed on http://mford-gae.appspot.com/map/ptestmap.html.
Simple https://github.com/nickfloros/simplemap & deployed on http://mford-gae.appspot.com/simplemap/ptestmap2.html
Please note that the same issues occurs using the maps Javascript API with dart:js.
Running Safari Web inspector on an iphone 5 I was able to get the following stack trace. (see https://drive.google.com/file/d/0B-3548oLJZ-Td3BTd0lGR2kwVTA/edit?usp=sharing for more details)
Are you aware of any issues?
As an aside I tested https://www.dartlang.org/samples/google_maps/ on IOS and than works .. So I am really confused ...
Any thoughts?
Thanks
Nick
Hi!
In the GeocodeRequest object the property componentRestrictions is missing.
https://google-developers.appspot.com/maps/documentation/javascript/geocoding#GeocodingRequests
componentRestrictions (optional) — Used to restrict results to a specific area. A filter consists of one or more of: route, locality, administrativeArea, postalCode or country. Only the results that match all the filters will be returned. Filter values support the same methods of spelling correction and partial matching as other geocoding requests. See Component Filtering in the Geocoding web service for further details.
Thanks.
According to the Google reference documentation this functions returns a LatLngBounds object and not a bool as specified in lat_lng_bounds.dart
If you uncomment the dependency_overrides in pubspec.yaml, pub get
, and dartanalyzer lib/src/google_maps_src.dart
, you see a bunch of new errors (warnings (but really errors)):
warning • A function of type '(JsFunction) → (DataFeature) → DataStyleOptions' can't be assigned to a location of type '(dynamic) → (DataFeature) → DataStyleOptions' at lib/src/core/data/data.dart:54:16 • strong_mode_uses_dynamic_as_bottom
warning • A function of type '(JsFunction) → (DataFeature) → DataStyleOptions' can't be assigned to a location of type '(dynamic) → (DataFeature) → DataStyleOptions' at lib/src/core/data/data.dart:93:16 • strong_mode_uses_dynamic_as_bottom
warning • A function of type '(JsFunction) → (DataFeature) → DataStyleOptions' can't be assigned to a location of type '(dynamic) → (DataFeature) → DataStyleOptions' at lib/src/core/data/data_data_options.dart:43:16 • strong_mode_uses_dynamic_as_bottom
warning • A function of type '(JsFunction) → (DataFeature) → DataStyleOptions' can't be assigned to a location of type '(dynamic) → (DataFeature) → DataStyleOptions' at lib/src/core/data/data_data_options.dart:78:16 • strong_mode_uses_dynamic_as_bottom
warning • A function of type '(JsFunction) → (DataFeature) → DataStyleOptions' can't be assigned to a location of type '(dynamic) → (DataFeature) → DataStyleOptions' at lib/src/google_maps_src.g.dart:1567:16 • strong_mode_uses_dynamic_as_bottom
warning • A function of type '(JsFunction) → (DataFeature) → DataStyleOptions' can't be assigned to a location of type '(dynamic) → (DataFeature) → DataStyleOptions' at lib/src/google_maps_src.g.dart:1633:16 • strong_mode_uses_dynamic_as_bottom
warning • A function of type '(JsFunction) → (DataFeature) → DataStyleOptions' can't be assigned to a location of type '(dynamic) → (DataFeature) → DataStyleOptions' at lib/src/google_maps_src.g.dart:1743:16 • strong_mode_uses_dynamic_as_bottom
warning • A function of type '(JsFunction) → (DataFeature) → DataStyleOptions' can't be assigned to a location of type '(dynamic) → (DataFeature) → DataStyleOptions' at lib/src/google_maps_src.g.dart:1778:16 • strong_mode_uses_dynamic_as_bottom
Great package I've been using for some time now. Updated to Dart v2.0.0 and resolution of pub get produces error :
Because func 1.0.0 requires SDK version >=1.9.0 <2.0.0 and no versions of func match >1.0.0 <2.0.0, func ^1.0.0 is forbidden.
I am trying to do:
map.zoom = zoomLevel
I get the following stack trace:
Uncaught Error: Unhandled exception:
Closure call with mismatched arguments: function 'call'
NoSuchMethodError: incorrect number of arguments passed to method named 'call'
Receiver: Closure: (dynamic) => dynamic
Tried calling: call()
Found: call(e)
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
Stack Trace:
#0 JsObject._callMethod (dart:js:235)
#1 JsObject.callMethod (dart:js:225)
#2 JsObject.callMethod (dart:js:228)
#3 GMap.zoom= (package:google_maps/src/generated/core/map/map.dart:119:43)
#4 smoothZoomIn.<anonymous closure> (http://127.0.0.1:3030/blunka_home_dart/web/blunka_home_dart.dart:97:11)
#5 Future.Future.delayed.<anonymous closure> (dart:async/future.dart:201)
#6 _rootRunUnary (dart:async/zone.dart:717)
#7 _RootZone.runUnary (dart:async/zone.dart:854)
#8 _Future._propagateToListeners.handleValueCallback (dart:async/future_impl.dart:439)
#9 _Future._propagateToListeners (dart:async/future_impl.dart:522)
#10 _Future._complete (dart:async/future_impl.dart:303)
#11 _SyncCompleter.complete (dart:async/future_impl.dart:44)
#12 Future.Future.delayed.<anonymous closure> (dart:async/future.dart:203)
#13 _createTimer.<anonymous closure> (dart:async-patch/timer_patch.dart:11)
#14 _Timer._Timer.<anonymous closure> (file:///Volumes/data/b/build/slave/dartium-mac-full-stable/build/src/dart/tools/dom/src/native_DOMImplementation.dart:549)
There is an error when I try to use the package with DDC. Works fine in Dartium.
req.load
load
load
fetch
check
enable
enable
(anonymous function)
(anonymous function)
each
enable
init
callGetModule
completeLoad
onScriptLoad
Uncaught Error: Script error for "packages/google_maps/lib__google_maps", needed by: packages/avstudios_website/lib__website__components__templates__blocks_template_component
makeError
onScriptError
Error compiling dartdevc module:google_maps|lib/lib__google_maps.js
[error] The return type 'TypedJsArray' isn't a 'List<FusionTablesStyle>', as defined by the method 'styles'. (package:google_maps/src/generated/core/layers/fusion_tables_layer_options.dart, line 32, col 41)
[error] The return type 'TypedJsArray' isn't a 'List<MapTypeStyle>', as defined by the method 'styles'. (package:google_maps/src/generated/core/map/map_options.dart, line 80, col 36)
[error] Invalid override. The type of 'MapTypeRegistry.set' ('(String, MapType) → void') isn't a subtype of 'MVCObject.set' ('(String, dynamic) → void'). (package:google_maps/src/generated/core/map_types/map_type_registry.dart, line 24, col 3)
[error] The return type 'TypedJsArray' isn't a 'List<MapTypeStyler>', as defined by the method 'stylers'. (package:google_maps/src/generated/core/map_types/map_type_style.dart, line 28, col 38)
[error] The return type 'TypedJsArray' isn't a 'List<E>', as defined by the method 'getArray'. (package:google_maps/src/generated/core/mvc/mvc_array.dart, line 56, col 25)
[error] Invalid override. The type of 'MVCArray.values=' ('(Map<String, Object>) → void') isn't a subtype of 'MVCObject.values=' ('(Map<dynamic, dynamic>) → void'). (package:google_maps/src/generated/core/mvc/mvc_array.dart, line 90, col 3)
[error] The return type 'TypedJsArray' isn't a 'List<num>', as defined by the method 'coords'. (package:google_maps/src/generated/core/overlays/marker_shape.dart, line 24, col 27)
[error] The return type 'TypedJsArray' isn't a 'List<IconSequence>', as defined by the method 'icons'. (package:google_maps/src/generated/core/overlays/polyline_options.dart, line 32, col 35)
[error] The return type 'TypedJsArray' isn't a 'List<DirectionsStep>', as defined by the method 'steps'. (package:google_maps/src/generated/core/services/directions_leg.dart, line 40, col 37)
[error] The return type 'TypedJsArray' isn't a 'List<LatLng>', as defined by the method 'viaWaypoints'. (package:google_maps/src/generated/core/services/directions_leg.dart, line 42, col 36)
[error] The return type 'TypedJsArray' isn't a 'List<DirectionsWaypoint>', as defined by the method 'waypoints'. (package:google_maps/src/generated/core/services/directions_request.dart, line 44, col 45)
[error] The return type 'TypedJsArray' isn't a 'List<DirectionsRoute>', as defined by the method 'routes'. (package:google_maps/src/generated/core/services/directions_result.dart, line 24, col 39)
[error] The return type 'TypedJsArray' isn't a 'List<DirectionsLeg>', as defined by the method 'legs'. (package:google_maps/src/generated/core/services/directions_route.dart, line 28, col 35)
[error] The return type 'TypedJsArray' isn't a 'List<LatLng>', as defined by the method 'overviewPath'. (package:google_maps/src/generated/core/services/directions_route.dart, line 30, col 36)
[error] The return type 'TypedJsArray' isn't a 'List<String>', as defined by the method 'warnings'. (package:google_maps/src/generated/core/services/directions_route.dart, line 32, col 32)
[error] The return type 'TypedJsArray' isn't a 'List<num>', as defined by the method 'waypointOrder'. (package:google_maps/src/generated/core/services/directions_route.dart, line 34, col 34)
[error] The return type 'TypedJsArray' isn't a 'List<LatLng>', as defined by the method 'path'. (package:google_maps/src/generated/core/services/directions_step.dart, line 32, col 28)
[error] The return type 'TypedJsArray' isn't a 'List<DirectionsStep>', as defined by the method 'steps'. (package:google_maps/src/generated/core/services/directions_step.dart, line 36, col 37)
[error] The return type 'TypedJsArray' isn't a 'List<String>', as defined by the method 'destinationAddresses'. (package:google_maps/src/generated/core/services/distance_matrix_response.dart, line 24, col 44)
[error] The return type 'TypedJsArray' isn't a 'List<String>', as defined by the method 'originAddresses'. (package:google_maps/src/generated/core/services/distance_matrix_response.dart, line 26, col 39)
[error] The return type 'TypedJsArray' isn't a 'List<DistanceMatrixResponseRow>', as defined by the method 'rows'. (package:google_maps/src/generated/core/services/distance_matrix_response.dart, line 28, col 47)
[error] The return type 'TypedJsArray' isn't a 'List<DistanceMatrixResponseElement>', as defined by the method 'elements'. (package:google_maps/src/generated/core/services/distance_matrix_response_row.dart, line 24, col 55)
[error] The argument type 'TypedJsArray' can't be assigned to the parameter type 'List<ElevationResult>'. (package:google_maps/src/generated/core/services/elevation_service.dart, line 25, col 134)
[error] The argument type 'TypedJsArray' can't be assigned to the parameter type 'List<ElevationResult>'. (package:google_maps/src/generated/core/services/elevation_service.dart, line 28, col 137)
[error] The argument type 'TypedJsArray' can't be assigned to the parameter type 'List<GeocoderResult>'. (package:google_maps/src/generated/core/services/geocoder.dart, line 25, col 120)
[error] The return type 'TypedJsArray' isn't a 'List<String>', as defined by the method 'types'. (package:google_maps/src/generated/core/services/geocoder_address_component.dart, line 28, col 29)
[error] The return type 'TypedJsArray' isn't a 'List<GeocoderAddressComponent>', as defined by the method 'addressComponents'. (package:google_maps/src/generated/core/services/geocoder_result.dart, line 24, col 59)
[error] The return type 'TypedJsArray' isn't a 'List<String>', as defined by the method 'types'. (package:google_maps/src/generated/core/services/geocoder_result.dart, line 30, col 29)
[error] The return type 'TypedJsArray' isn't a 'List<LatLng>', as defined by the method 'locations'. (package:google_maps/src/generated/core/services/location_elevation_request.dart, line 24, col 33)
[error] The return type 'TypedJsArray' isn't a 'List<LatLng>', as defined by the method 'path'. (package:google_maps/src/generated/core/services/path_elevation_request.dart, line 24, col 28)
[error] The return type 'TypedJsArray' isn't a 'List<TransitAgency>', as defined by the method 'agencies'. (package:google_maps/src/generated/core/services/transit_line.dart, line 24, col 39)
[error] The return type 'TypedJsArray' isn't a 'List<StreetViewLink>', as defined by the method 'links'. (package:google_maps/src/generated/core/street_view/street_view_panorama.dart, line 59, col 37)
[error] The return type 'TypedJsArray' isn't a 'List<StreetViewLink>', as defined by the method 'links'. (package:google_maps/src/generated/core/street_view/street_view_panorama_data.dart, line 28, col 37)
Please fix all errors before compiling (warnings are okay).
xhr.onreadystatechange
I use the google_maps package in a polymer (0.5) app and during release build it complains about a duplicated library name in
both have: library google_maps;
thanks for the lib!
Hello, I am having some trouble with this. I created a bare bones AngularDart app and installed the maps library, but I am still getting the following error:
dart_sdk.js:101409 EXCEPTION: Type 'IdentityCodec' is not a subtype of expected type 'Codec<String, dynamic>'.
STACKTRACE:
dart:sdk_internal 3969:19 as_C
package:js_wrapping/adapter/js_list.dart 29:39 created
package:js_wrapping/util/codec.dart 122:32 asJsObject
package:js_wrapping/util/codec.dart 77:56 convert
dart:sdk_internal 34270:29 encode
package:google_maps/src/google_maps_src_places.g.dart 64:41 set types
package:google_address/src/google_maps/google_maps.dart 39:45 ngOnInit
package:google_address/app_component.template.dart 64:22 detectChangesInternal
package:angular/src/core/linker/app_view.dart 418:7 detectCrash
package:angular/src/core/linker/app_view.dart 395:7 detectChanges
package:google_address/app_component.template.dart 98:16 detectChangesInternal
package:angular/src/core/linker/app_view.dart 418:7 detectCrash
package:angular/src/core/linker/app_view.dart 395:7 detectChanges
package:angular/src/core/change_detection/host.dart 192:13 [_runTickGuarded]
package:angular/src/core/change_detection/host.dart 149:27 tick
package:angular/src/core/application_ref.dart 104:5 [_loadComponent]
package:angular/src/core/application_ref.dart 97:21 src__runtime__optimizations.unsafeCast.run.dart.fn
package:angular/src/core/change_detection/host.dart 250:18 runInZone.dart.fn
package:angular/src/core/zone/ng_zone.dart 178:16 parent.run.dart.fn
dart:sdk_internal 28844:14 run
package:angular/src/core/zone/ng_zone.dart 175:18 [_run]
dart:sdk_internal 29045:14 run
package:angular/src/core/zone/ng_zone.dart 327:22 run
package:angular/src/core/application_ref.dart 138:49 runInZone
package:angular/src/core/change_detection/host.dart 248:5 run
package:angular/src/core/application_ref.dart 67:23 bootstrap
package:angular/src/bootstrap/run.dart 188:16 runApp
main.dart 5:3 main
main.dart.bootstrap.js 668:12 <fn>
dart:sdk_internal 1717:29 onScriptLoad
Here is a link to a bare bones repro of the issue:
Google Address AutoComplete
Thank you in advance for any guidance!
In my webapp, I am using a custom Tile Server to get the map tiles.
However when using ImageMapTypeOptions and setting getTIleUrl by using the following code:
ImageMapTypeOptions()
..getTileUrl = (g.Point coord, double zoom) {
return "https://..url../$zoom/${coord.x}/${coord.y}?access_token=$API_KEY";
}
I get the error that coord has no method "y".
When using the code print(coord.y)
, i always get "null" as output.
Cheers!
Is there a reason checkResize isn't mapped over to this library?
Would be super nice 😄
after using e.g.
var panControlOptions = new PanControlOptions();
panControlOptions.position = ControlPosition.BOTTOM_RIGHT;
final mapOptions = new MapOptions()
..panControlOptions = panControlOptions
;
the pan control is NOT in the bottom right as expected. It is in the bottom center!
Hey Alexandre,
I'm trying to create an AutocompletionRequest
with a country restriction. My code currently looks like this:
var request = new AutocompletionRequest()
..bounds = _map.bounds
..input = query
..types = ['geocode']
..componentRestrictions.country = 'au';
But I'm seeing the following in my console:
NullError: method not found: 'set$country' on null
Which is totally not what I'm looking for. Halp?
How do I integrate it with flutter? I can't import dart:html in flutter and errors are shown because of it.
M4 is breaking lots of things of course.. but have to love the progress!
FYI for this package on M4
Internal error: 'http://127.0.0.1:3030/Users/dfils/src/dart/fedsearch/web/out/packages/google_maps/js_wrap.dart': Error: line 24 pos 37: cannot resolve class name 'InvocationMirror' from 'ProxyInvocationMirror'
class ProxyInvocationMirror extends InvocationMirror {
I tried to do my first steps and followed the sample code.
But unfortunately I run into:
Exception: The null object does not have a method '[]'.
NoSuchMethodError : method not found: '[]'
Receiver: null
Arguments: ["maps"] package:google_maps/google_maps.dart:168:14
maps package:google_maps/google_maps.dart:168:14
LatLng.LatLng package:google_maps/src/…ed/core/base/lat_lng.dart:24:19
main clickme.dart:11:20
My code:
import 'dart:html';
import 'package:google_maps/google_maps.dart';
void main( ) {
final mapOptions = new MapOptions( )
..zoom = 8
..center = new LatLng( -34.397, 150.644 )
..mapTypeId = MapTypeId.ROADMAP;
I am sure I am doing something wrong. But since I am new to dart and google_maps.dart I have no idea what I should do...
Maybe some kind of better error message could help me and others.
pubspec.yaml:
name: clickme
dependencies:
browser: any
google_maps: any
When calling:
var map = new GMap(mapTarget, mapOptions);
It throws:
Uncaught TypeError: Cannot read property 'undefined_changed' of undefined
Not sure if it's your lib, dart2js, or what but at least we have a bug to track.
I'm on SDK 0.5.5.0 and tried google_maps .9 and .10 versions.
Could part of this library like geocoding etc be split from the map embedding mechanism and let the html-less library be used in Flutter?
Thanks for the quick response to my previous issue - I've updated to v3.3.1. Now I get the following error in build using Dart v2.0.0 :
[error] The argument type 'String' can't be assigned to the parameter type 'Symbol'. (package:google_maps/util/async.dart, line 45, col 13)
The comment-based generics syntax will be removed from the Dart SDK tools (like DDC, analyzer) "soon." dart-lang/sdk#28796
Such syntax (like in getStreamProviderFor
) needs to be updated, and the minimum Dart SDK in pubspec.yaml needs to be bumped to 1.21, when the non-comment-based syntax was introduced.
I'm trying to add GeoJSON on map but have an error: EXCEPTION: InvalidValueError: not a Feature or FeatureCollection
GeoJSON is correct and works properly with Google Maps sample (https://developers.google.com/maps/documentation/javascript/examples/layer-data-dragndrop)
My code:
class AppComponent implements OnInit {
void ngOnInit() {
final mapOptions = MapOptions()
..zoom = 8
..center = LatLng(-34.397, 150.644);
GMap map = GMap(document.getElementById('map-canvas'), mapOptions);
map.data.addGeoJson({ "type": "FeatureCollection",
"features": [
{ "type": "Feature",
"geometry": {"type": "Point", "coordinates": [102.0, 0.5]},
"properties": {"prop0": "value0"}
},
{ "type": "Feature",
"geometry": {
"type": "LineString",
"coordinates": [
[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]
]
},
"properties": {
"prop0": "value0",
"prop1": 0.0
}
},
{ "type": "Feature",
"geometry": {
"type": "Polygon",
"coordinates": [
[ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
[100.0, 1.0], [100.0, 0.0] ]
]
},
"properties": {
"prop0": "value0",
"prop1": {"this": "that"}
}
}
]
});
}
}
Dart Angular 5, Dart version is 2.0.0-dev.69.5
Hi,
Thanks you for this package, you did a great job!
I'm having difficulties using event.trigger
. I only found one example using it, but not like I want.
I explain my problem here:
http://stackoverflow.com/questions/39512455/dart-google-maps-triggering-event
Thanks for your help.
MouseEvent class do not contain key codes.
Is it possible to get key code on mouse click event?
final mapOptions = new gmap.MapOptions()
..zoom = 8
..disableDoubleClickZoom = true
..center = new gmap.LatLng(41.850033, -87.6500523);
map = new gmap.GMap(mapRoot, mapOptions);
map.onClick.listen((gmap.MouseEvent me) {
// TODO How to get key code there?
//if (me.ctrlKey || me.metaKey)
addMarker(me.latLng, ctrlClick);
});
I have an issue with opening second instance on map.
Second instance loss position and controls. All other instance have the same issue. If make it FullScreen buttons are back.
Code is following:
final mapOptions = new gmap.MapOptions()
..zoom = 8
..disableDoubleClickZoom = true
..center = new gmap.LatLng(41.850033, -87.6500523);
map = new gmap.GMap(mapRoot, mapOptions);
One more thing if I include the Maps API JavaScript using a script tag in div with each instance it fixes focus, but controls are still missed.
Are you planning on updating this to the current release version? I'm keen on MarkerOptions.label.
Canceling event handlers doesn't release the memory. Here's an example:
Marker m = new Marker();
for (int k = 0; k < 100000; ++k) {
m.onClick.listen((_) => print('foo')).cancel();
}
RAM used by the browser will increase each time the loop runs. It's not so bad in this example, but if the closure has references to other objects, they don't seem to be GC'd either.
If there's a different way I'm supposed to be canceling these, happy to try that.
When calling new GMap
, an error in the console appears, stating Cannot read property '$index' of undefined at Object.J.$index$asx
.
Been searching for hours and can't find a solution.
Dart code:
import "package:google_maps/google_maps.dart";
import "dart:html";
// Google Map
GMap map;
void main(List<String> args){
map = new GMap(querySelector("mapElement"));
}
Exception:
Uncaught TypeError: Cannot read property '$index' of undefined
at Object.J.$index$asx (DartMap.js:6250)
at StaticClosure.dart.main (google_maps_src.g.dart:7623)
at startRootIsolate_closure.call$0 (isolate_helper.dart:122)
at _IsolateContext.eval$1 (isolate_helper.dart:474)
at Object.startRootIsolate (isolate_helper.dart:121)
at DartMap.js:6728
at DartMap.js:6729
at DartMap.js:6709
at DartMap.js:6720
at DartMap.js:6732
Hi
building an app where I need to get the LatLng of where the users clicks on the map. The app uses web_ui. When It come to implement the onClick.listen call back I get the following error
#0 Proxy._forward (package:js/js.dart:1043:22)
#1 Proxy.
#2 MouseEvent.latLng (package:google_maps/src/core/events/mouse_event.dart:23:43)
#3 addLatLng.addLatLng (http://127.0.0.1:3030/C:/Projects/dart/TestMap/web/testmap.dart:19:18)
#4 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:191:14)
#5 _DelayedData.perform (dart:async/stream_impl.dart:348:23)
#6 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:420:18)
#7 _PendingEvents.schedule. (dart:async/stream_impl.dart:391:17)
#8 _asyncRunCallback._asyncRunCallback (dart:async/event_loop.dart:9:15)
#9 Timer.Timer. (dart:async-patch/timer_patch.dart:9:15)
#10 _timerFactoryClosure.. (file:///E:/b/build/slave/dartium-win-full-trunk/build/src/dart/tools/dom/src/native_DOMImplementation.dart:177:13)
Exception: Proxy js-ref-15 has been invalidated.
Also here is a screen shot of what the debugger thinks of the callback event variable.
To simplify the app I created the following and still get the same error
import 'dart:html';
import 'package:google_maps/google_maps.dart' as gMap;
void main() {
final mapOptions = new gMap.MapOptions()
..zoom=14
..center=new gMap.LatLng(34,-89)
..mapTypeId = gMap.MapTypeId.ROADMAP;
final map = new gMap.GMap(query('#map_canvas'),mapOptions);
map.onClick.listen(addLatLng);
}
void addLatLng(gMap.MouseEvent event) {
print('${event.latLng.lat}');
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<title>TestMap</title>
<link rel="stylesheet" href="testmap.css">
<link href="https://www.google-developers.appspot.com/maps/documentation/javascript/examples/default.css" rel="stylesheet"/>
</head>
<body>
<div id="map_canvas" style="height:400px"></div>
<div id="sample_container_id">
<p id="sample_text_id"></p>
</div>
<script src="http://maps.google.com/maps/api/js?sensor=false&libraries=geometry"></script>
<script type="application/dart" src="testmap.dart"></script>
<script src="packages/browser/dart.js"></script>
</body>
</html>
Dev environment is
Please note that exactly the same program works fine on MacOS but the Dart editor SDK version is r23200.
I also tried implementing a simple interface to google maps api using js interop and the data returned to the callback function look equally strange - I was expecting a nice simple JSON format ; anyway.
Any thoughts?
Thanks
Hi - I am attempting to use the Google Maps API in Dart to get images based on geolocated coordinates. I was looking into the JsInterop files, which has a getUrl method - but that method does not exist on the Dart side. Is there another way to get the Url of the PlacePhoto?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.