-
Notifications
You must be signed in to change notification settings - Fork 171
Description
Platforms
iOS
Version of flutter maplibre_gl
0.21.0 (using ^0.21.0 in pubspec.yaml, resolved to 0.21.0)
Bug Description
Building a Flutter application for iOS fails when specific enum values (Tracking, TrackingCompass, COMPASS) are used for myLocationTrackingMode or myLocationRenderMode properties of the MapLibreMap widget. The build succeeds if these properties are commented out or potentially set to None/NORMAL. This prevents the use of essential map tracking and user location rendering features on iOS.
Steps to Reproduce
- Create a Flutter project using
maplibre_gl: ^0.21.0. - Add a
MapLibreMapwidget to a screen. - Set the
myLocationEnabledproperty totrue. - Set the
myLocationTrackingModeproperty tomaplibre_gl.MyLocationTrackingMode.TrackingCompassORmaplibre_gl.MyLocationTrackingMode.Tracking. - Alternatively, or additionally, set the
myLocationRenderModeproperty tomaplibre_gl.MyLocationRenderMode.COMPASS. - Attempt to build the application for an iOS device or simulator (e.g.,
flutter build ios --no-codesign).
Expected Results
The iOS build should complete successfully, allowing the application to run with the specified location tracking and rendering modes active.
Actual Results
The iOS build fails during the Xcode build phase with one of the following errors, depending on which enum value was used:
-
When using
MyLocationTrackingMode.TrackingCompass:
Error (Xcode): lib/your_file.dart:line:col: Error: Member not found: 'TrackingCompass'. -
When using
MyLocationTrackingMode.Tracking:
Error (Xcode): lib/your_file.dart:line:col: Error: Member not found: 'Tracking'. -
When using
MyLocationRenderMode.COMPASS:
Error (Xcode): lib/your_file.dart:line:col: Error: Member not found: 'COMPASS'.
(Replace your_file.dart:line:col with the actual location from the build error log).
Code Sample
// import 'package:flutter/material.dart';
import 'package:maplibre_gl/maplibre_gl.dart' as maplibre_gl;
class MapScreen extends StatefulWidget {
const MapScreen({Key? key}) : super(key: key);
@override
State<MapScreen> createState() => _MapScreenState();
}
class _MapScreenState extends State<MapScreen> {
maplibre_gl.MapLibreMapController? _mapController;
void _onMapCreated(maplibre_gl.MapLibreMapController controller) {
_mapController = controller;
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: maplibre_gl.MapLibreMap(
onMapCreated: _onMapCreated,
initialCameraPosition: const maplibre_gl.CameraPosition(
target: maplibre_gl.LatLng(0, 0), // Replace with desired initial position
zoom: 14.0,
),
styleString: 'YOUR_MAP_STYLE_URL_OR_JSON', // Replace with your map style
myLocationEnabled: true,
// *** These lines cause the iOS build failure in v0.21.0 ***
myLocationTrackingMode: maplibre_gl.MyLocationTrackingMode.TrackingCompass, // Fails build
// myLocationTrackingMode: maplibre_gl.MyLocationTrackingMode.Tracking, // Also fails build
// myLocationRenderMode: maplibre_gl.MyLocationRenderMode.COMPASS, // Also fails build
// Build succeeds if the above lines are commented out or potentially set to .None / .NORMAL
myLocationTrackingMode: maplibre_gl.MyLocationTrackingMode.None, // Build OK
myLocationRenderMode: maplibre_gl.MyLocationRenderMode.NORMAL, // Build OK
trackCameraPosition: true, // Recommended when using location tracking
),
);
}
}