这是代码,
final Set<Polyline> _polylines = {};
List<LatLng> latlngList = List();
static var today = DateTime.now();
String Daily = DateFormat('yyyy-MM-dd').format(today);
void getLocation() async {
final location = await _firestore
.collection('$Daily')
.orderBy('time', descending: false)
.getDocuments();
for (var location in location.documents) {
LatLng lat =
LatLng(location.data['latittude'], location.data['longitude']);
latlngList.add(lat);
_polylines.add(Polyline(
polylineId: PolylineId('adress'),
color: Colors.blue,
visible: true,
width: 5,
points: latlngList));
setState(() {
_markers.add(Marker(
markerId: MarkerId('addr'),
position: lat,
draggable: true,
infoWindow: InfoWindow(
title: latlngList[0].toString(),
snippet: '5 Star Rating',
),
icon: BitmapDescriptor.defaultMarker,
));
});
}
}
当我在Google map 小部件上使用它来显示标记和折线时。它以错误的顺序显示Output Image I am getting
和实际的输入路径,我添加了input of marker I provided。红线实际上是我在输入时给出的标记
最佳答案
尝试更改markerId
markerId = MarkerId('addr')
而是使用MarkerId('adress')或具有动态值(value)的东西
关于firebase - Flutter Firestore甚至在提供orderby函数后仍以错误的顺序获取,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60299558/