map entry flutter code example
Example 1: dart key value pair list
void main() {
final testMap = {"a": 1, "b": 2, "c": 3, "d": 4, "e": 5};
for (final mapEntry in testMap.entries) {
final key = mapEntry.key;
final value = mapEntry.value;
print('Key: $key, Value: $value'); // Key: a, Value: 1 ...
}
}
Example 2: flutter map
Widget build(BuildContext context) {
return FlutterMap(
options: MapOptions(
center: LatLng(51.5, -0.09),
zoom: 13.0,
),
layers: [
TileLayerOptions(
urlTemplate: "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
subdomains: ['a', 'b', 'c']
),
MarkerLayerOptions(
markers: [
Marker(
width: 80.0,
height: 80.0,
point: LatLng(51.5, -0.09),
builder: (ctx) =>
Container(
child: FlutterLogo(),
),
),
],
),
],
);
}