Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.1.0+2

* Fix crash when converting Markers with icon explicitly set to null. [Issue](https://github.com/flutter/flutter/issues/64938).

## 0.1.0+1

* Port e2e tests to use the new integration_test package.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,22 +379,25 @@ gmaps.MarkerOptions _markerOptionsFromMarker(
Marker marker,
gmaps.Marker currentMarker,
) {
final iconConfig = marker.icon.toJson() as List;
final iconConfig = marker.icon?.toJson() as List;
gmaps.Icon icon;

if (iconConfig[0] == 'fromAssetImage') {
// iconConfig[2] contains the DPIs of the screen, but that information is
// already encoded in the iconConfig[1]

icon = gmaps.Icon()
..url = ui.webOnlyAssetManager.getAssetUrl(iconConfig[1]);

// iconConfig[3] may contain the [width, height] of the image, if passed!
if (iconConfig.length >= 4 && iconConfig[3] != null) {
final size = gmaps.Size(iconConfig[3][0], iconConfig[3][1]);
icon
..size = size
..scaledSize = size;
if (iconConfig != null) {
if (iconConfig[0] == 'fromAssetImage') {
assert(iconConfig.length >= 2);
// iconConfig[2] contains the DPIs of the screen, but that information is
// already encoded in the iconConfig[1]

icon = gmaps.Icon()
..url = ui.webOnlyAssetManager.getAssetUrl(iconConfig[1]);

// iconConfig[3] may contain the [width, height] of the image, if passed!
if (iconConfig.length >= 4 && iconConfig[3] != null) {
final size = gmaps.Size(iconConfig[3][0], iconConfig[3][1]);
icon
..size = size
..scaledSize = size;
}
}
}
return gmaps.MarkerOptions()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: google_maps_flutter_web
description: Web platform implementation of google_maps_flutter
homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter
version: 0.1.0+1
version: 0.1.0+2

flutter:
plugin:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,5 +98,17 @@ void main() {

expect(controller.markers[MarkerId('1')].infoWindowShown, isFalse);
});

// https://github.com/flutter/flutter/issues/64938
testWidgets('markers with icon:null work', (WidgetTester tester) async {
final markers = {
Marker(markerId: MarkerId('1'), icon: null),
};

controller.addMarkers(markers);

expect(controller.markers.length, 1);
expect(controller.markers[MarkerId('1')].marker.icon, isNull);
});
});
}