[google_maps_flutter] Update and comment out the 'set marker icon' sample. (#1640) This updates the sample to adapt to the ImageStream listener API changes in https://github.com/flutter/flutter/pull/32936 As we cannot use the new API before it makes it to stable I'm commenting out the sample for now(if we update it now it won't compile on stable, and if we leave it as is it breaks CI on master).
diff --git a/packages/google_maps_flutter/CHANGELOG.md b/packages/google_maps_flutter/CHANGELOG.md index 0cda582..9ecdd88 100644 --- a/packages/google_maps_flutter/CHANGELOG.md +++ b/packages/google_maps_flutter/CHANGELOG.md
@@ -1,3 +1,8 @@ +## 0.5.14+1 + +* Example app update(comment out usage of the ImageStreamListener API which has a breaking change + that's not yet on master). See: https://github.com/flutter/flutter/issues/33438 + ## 0.5.14 * Adds onLongPress callback for GoogleMap.
diff --git a/packages/google_maps_flutter/example/lib/place_marker.dart b/packages/google_maps_flutter/example/lib/place_marker.dart index 7699239..c305984 100644 --- a/packages/google_maps_flutter/example/lib/place_marker.dart +++ b/packages/google_maps_flutter/example/lib/place_marker.dart
@@ -4,7 +4,6 @@ import 'dart:async'; import 'dart:math'; -import 'dart:typed_data'; import 'dart:ui'; import 'package:flutter/material.dart'; @@ -215,36 +214,42 @@ }); } - void _setMarkerIcon(BitmapDescriptor assetIcon) { - if (selectedMarker == null) { - return; - } - - final Marker marker = markers[selectedMarker]; - setState(() { - markers[selectedMarker] = marker.copyWith( - iconParam: assetIcon, - ); - }); - } - - Future<BitmapDescriptor> _getAssetIcon(BuildContext context) async { - final Completer<BitmapDescriptor> bitmapIcon = - Completer<BitmapDescriptor>(); - final ImageConfiguration config = createLocalImageConfiguration(context); - - const AssetImage('assets/red_square.png') - .resolve(config) - .addListener((ImageInfo image, bool sync) async { - final ByteData bytes = - await image.image.toByteData(format: ImageByteFormat.png); - final BitmapDescriptor bitmap = - BitmapDescriptor.fromBytes(bytes.buffer.asUint8List()); - bitmapIcon.complete(bitmap); - }); - - return await bitmapIcon.future; - } +// A breaking change to the ImageStreamListener API affects this sample. +// I've updates the sample to use the new API, but as we cannot use the new +// API before it makes it to stable I'm commenting out this sample for now +// TODO(amirh): uncomment this one the ImageStream API change makes it to stable. +// https://github.com/flutter/flutter/issues/33438 +// +// void _setMarkerIcon(BitmapDescriptor assetIcon) { +// if (selectedMarker == null) { +// return; +// } +// +// final Marker marker = markers[selectedMarker]; +// setState(() { +// markers[selectedMarker] = marker.copyWith( +// iconParam: assetIcon, +// ); +// }); +// } +// +// Future<BitmapDescriptor> _getAssetIcon(BuildContext context) async { +// final Completer<BitmapDescriptor> bitmapIcon = +// Completer<BitmapDescriptor>(); +// final ImageConfiguration config = createLocalImageConfiguration(context); +// +// const AssetImage('assets/red_square.png') +// .resolve(config) +// .addListener(ImageStreamListener((ImageInfo image, bool sync) async { +// final ByteData bytes = +// await image.image.toByteData(format: ImageByteFormat.png); +// final BitmapDescriptor bitmap = +// BitmapDescriptor.fromBytes(bytes.buffer.asUint8List()); +// bitmapIcon.complete(bitmap); +// })); +// +// return await bitmapIcon.future; +// } @override Widget build(BuildContext context) { @@ -330,16 +335,22 @@ child: const Text('change zIndex'), onPressed: _changeZIndex, ), - FlatButton( - child: const Text('set marker icon'), - onPressed: () { - _getAssetIcon(context).then( - (BitmapDescriptor icon) { - _setMarkerIcon(icon); - }, - ); - }, - ), + // A breaking change to the ImageStreamListener API affects this sample. + // I've updates the sample to use the new API, but as we cannot use the new + // API before it makes it to stable I'm commenting out this sample for now + // TODO(amirh): uncomment this one the ImageStream API change makes it to stable. + // https://github.com/flutter/flutter/issues/33438 + // + // FlatButton( + // child: const Text('set marker icon'), + // onPressed: () { + // _getAssetIcon(context).then( + // (BitmapDescriptor icon) { + // _setMarkerIcon(icon); + // }, + // ); + // }, + // ), ], ), ],
diff --git a/packages/google_maps_flutter/example/test_driver/google_maps.dart b/packages/google_maps_flutter/example/test_driver/google_maps.dart index a08eb89..0efdb8b 100644 --- a/packages/google_maps_flutter/example/test_driver/google_maps.dart +++ b/packages/google_maps_flutter/example/test_driver/google_maps.dart
@@ -292,7 +292,7 @@ // still being investigated. // TODO(cyanglaz): Remove this temporary fix once the Maps SDK issue is resolved. // https://github.com/flutter/flutter/issues/27550 - await Future<dynamic>.delayed(Duration(seconds: 3)); + await Future<dynamic>.delayed(const Duration(seconds: 3)); final LatLngBounds firstVisibleRegion = await mapController.getVisibleRegion();
diff --git a/packages/google_maps_flutter/pubspec.yaml b/packages/google_maps_flutter/pubspec.yaml index 1238301..ecf9467 100644 --- a/packages/google_maps_flutter/pubspec.yaml +++ b/packages/google_maps_flutter/pubspec.yaml
@@ -2,7 +2,7 @@ description: A Flutter plugin for integrating Google Maps in iOS and Android applications. author: Flutter Team <flutter-dev@googlegroups.com> homepage: https://github.com/flutter/plugins/tree/master/packages/google_maps_flutter -version: 0.5.14 +version: 0.5.14+1 dependencies: flutter: