-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[google_maps_flutter] Strange issue when adding marker with some delay in IOS #169005
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
a: quality
A truly polished experience
found in release: 3.29
Found to occur in 3.29
found in release: 3.33
Found to occur in 3.33
has reproducible steps
The issue has been confirmed reproducible and is ready to work on
p: maps
Google Maps plugin
P3
Issues that are less important to the Flutter project
package
flutter/packages repository. See also p: labels.
platform-ios
iOS applications specifically
team-ios
Owned by iOS platform team
triaged-ios
Triaged by iOS platform team
Comments
Triage ReportI was able to reproduce the issue using the provided code sample on both the google_maps_flutter - 2.12.2
Code Sample (Same as OP)import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
void main() => runApp(MaterialApp(home: const GoogleMapIosIssue()));
class GoogleMapIosIssue extends StatefulWidget {
const GoogleMapIosIssue({super.key});
@override
State<GoogleMapIosIssue> createState() => _GoogleMapIosIssueState();
}
class _GoogleMapIosIssueState extends State<GoogleMapIosIssue> {
Set<Marker> markers = {};
@override
Widget build(BuildContext context) {
return Scaffold(
body: GoogleMap(
initialCameraPosition: const CameraPosition(
target: LatLng(20.5937, 78.9629),
zoom: 4,
),
markers: markers,
onMapCreated: onMapCreated,
),
);
}
void onMapCreated(controller) {
createItineraries();
_generateMarkers(1000);
setState(() {});
}
Future<void> createItineraries() async {
final double minLat = 14.925;
final double maxLat = 15.825;
final double minLng = 73.675;
final double maxLng = 74.215;
final random = Random();
for (int i = 0; i < 100; i++) {
await Future.delayed(const Duration(milliseconds: 10));
double lat = minLat + random.nextDouble() * (maxLat - minLat);
double lng = minLng + random.nextDouble() * (maxLng - minLng);
markers.add(
Marker(
markerId: MarkerId('marker11_$i'),
position: LatLng(lat, lng),
icon: BitmapDescriptor.defaultMarkerWithHue(
BitmapDescriptor.hueYellow,
),
),
);
}
setState(() {});
}
final double minLat = 8.0;
final double maxLat = 37.0;
final double minLng = 68.0;
final double maxLng = 97.0;
void _generateMarkers(int count) {
final random = Random();
for (int i = 0; i < count; i++) {
double lat = minLat + random.nextDouble() * (maxLat - minLat);
double lng = minLng + random.nextDouble() * (maxLng - minLng);
markers.add(
Marker(
markerId: MarkerId('marker_$i'),
position: LatLng(lat, lng),
icon: BitmapDescriptor.defaultMarkerWithHue(
BitmapDescriptor.hueMagenta,
),
),
);
}
setState(() {});
}
} stable (3.29.3) - flutter doctor -v
master (3.33.0-1.0.pre.123) - flutter doctor -v
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
a: quality
A truly polished experience
found in release: 3.29
Found to occur in 3.29
found in release: 3.33
Found to occur in 3.33
has reproducible steps
The issue has been confirmed reproducible and is ready to work on
p: maps
Google Maps plugin
P3
Issues that are less important to the Flutter project
package
flutter/packages repository. See also p: labels.
platform-ios
iOS applications specifically
team-ios
Owned by iOS platform team
triaged-ios
Triaged by iOS platform team
Steps to reproduce
Add large amount of marker on map and everything falls apart.
google_maps_flutter: ^2.10.0
Expected results
The markers should be plotted on given lat lng.
Actual results
the marker is plotted on given lat lng but also some random marker is added on map in case of ios
Code sample
Code sample
Screenshots or Video
Screenshots / Video demonstration
We can see that in android marker are in one place but in ios marker are placed randomly on mapLogs
Logs
[Paste your logs here]
Flutter Doctor output
Doctor output
The text was updated successfully, but these errors were encountered: