Closed
Description
Steps to Reproduce
I am using google_maps_flutter and want to use a custom icon for the marker. This works on Android, but on iOS it just displays the default marker. I get the following messages in the log when I click on the button to add the marker.
Sample code is supplied below - you will need to provide a bitmap file for the marker.
This is with google_maps_flutter version 0.3.0+1
I have tried the dev and master channels and the problem still exists.
This works in google_map_flutter 0.2.0, when the markers were part of the map controller.
Logs
[+11552 ms] [DEVICE LOG] 2019-02-28 12:41:37.702608+0000 localhost Runner[92988]: (CoreUI) [com.apple.coreui:framework] CUICatalog:
Invalid asset name supplied: '(null)'
[ ] [DEVICE LOG] 2019-02-28 12:41:37.702658+0000 localhost Runner[92988]: (CoreUI) [com.apple.coreui:framework] CUICatalog:
Invalid asset name supplied: '(null)'
[ ] [DEVICE LOG] 2019-02-28 12:41:37.703070+0000 localhost Runner[92988]: (CoreUI) [com.apple.coreui:framework] CUIThemeStore:
No theme registered with id=0
Code
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Google Maps Demo',
home: MapSample(),
);
}
}
class MapSample extends StatefulWidget {
@override
State<MapSample> createState() => MapSampleState();
}
class MapSampleState extends State<MapSample> {
Completer<GoogleMapController> _controller = Completer();
Map<MarkerId, Marker> markers = <MarkerId, Marker>{};
static final CameraPosition _kGooglePlex = CameraPosition(
target: LatLng(37.42796133580664, -122.085749655962),
zoom: 14.4746,
);
@override
Widget build(BuildContext context) {
return new Scaffold(
body: GoogleMap(
mapType: MapType.hybrid,
initialCameraPosition: _kGooglePlex,
markers: Set<Marker>.of(markers.values),
onMapCreated: (GoogleMapController controller) {
_controller.complete(controller);
},
),
floatingActionButton: FloatingActionButton.extended(
onPressed: _addMarker,
label: Text('Add Marker'),
icon: Icon(Icons.place),
),
);
}
Future<void> _addMarker() async {
//final GoogleMapController controller = await _controller.future;
final MarkerId markerId = MarkerId('test_marker');
final Marker marker = Marker(
markerId: markerId,
anchor: Offset(0.5, 0.5),
icon: BitmapDescriptor.fromAsset('assets/marker.png'),
position: LatLng(
37.42796133580664,
-122.085749655962,
),
infoWindow: InfoWindow.noText,
zIndex: 5,
);
setState(() {
markers[markerId] = marker;
});
}
}
[✓] Flutter (Channel stable, v1.2.1, on Mac OS X 10.14.3 18D109, locale en-GB)
• Flutter version 1.2.1 at /Users/samtoon/flutter
• Framework revision 8661d8aecd (13 days ago), 2019-02-14 19:19:53 -0800
• Engine revision 3757390fa4
• Dart version 2.1.2 (build 2.1.2-dev.0.0 0a7dcf17eb)
[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
• Android SDK at /Users/samtoon/Library/Android/sdk
• Android NDK location not configured (optional; useful for native profiling support)
• Platform android-28, build-tools 28.0.3
• ANDROID_HOME = /Users/samtoon/Library/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
• All Android licenses accepted.
[!] iOS toolchain - develop for iOS devices (Xcode 10.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 10.1, Build version 10B61
✗ Verify that all connected devices have been paired with this computer in Xcode.
If all devices have been paired, libimobiledevice and ideviceinstaller may require updating.
To update with Brew, run:
brew update
brew uninstall --ignore-dependencies libimobiledevice
brew uninstall --ignore-dependencies usbmuxd
brew install --HEAD usbmuxd
brew unlink usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller
• ios-deploy 1.9.4
• CocoaPods version 1.6.0.rc.2
[✓] Android Studio (version 3.3)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin version 33.3.1
• Dart plugin version 182.5215
• Java version OpenJDK Runtime Environment (build 1.8.0_152-release-1248-b01)
[✓] VS Code (version 1.31.1)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 2.24.0
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.