xxxxxxxxxx
void main() {
var details = new Map();
details['Usrname'] = 'admin';
details['Password'] = 'admin@123';
print(details);
}
// Output
// {Usrname: admin, Password: admin@123}
xxxxxxxxxx
// Dart Map with constructor
void main() {
Map<String, dynamic> student = new Map();
student['name'] = 'Abir';
student['Id'] = 'CSE19800459';
student['department'] = 'Computer Science Eng.';
//printing maps keys
print(student.keys);
// output: (name, Id, department)
//printing maps values
print(student.values);
// output: (Abir, CSE19800459, Computer Science Eng.)
}
xxxxxxxxxx
// Dart Map with method example
void main() {
Map<String, dynamic> person ={
'name': 'Sumon',
'age': '22',
'city':'Dhaka',
};
// add multiple element to the map..
person.addAll({'country': 'Bangladesh', 'gender': 'male'});
print(person);
// output:
//{name: Sumon, age: 22, city: Dhaka, country: Bangladesh, gender: male}
// remove speacific item from map..
person.remove('name');
print(person);
//output: {age: 22, city: Dhaka, country: Bangladesh, gender: male}
// remove all element from map..
person.clear();
print(person);
//output: {}
}
xxxxxxxxxx
void main() {
var details = {'Usrname':'tom','Password':'pass@123'};
details['Uid'] = 'U1oo1';
print(details);
}
xxxxxxxxxx
void main() {
Map person={'name':'Bijay Poudel',"age":20};
//name and age are key and Bijay and 20 are value
print(person);
}
xxxxxxxxxx
void main() {
Map<String, dynamic> myInfo = {
'name': 'Sabbir',
'age': 25,
'city': 'Narayanganj',
};
myInfo['country'] = 'Bangladesh';
print(myInfo);
}
// output
{name: Sabbir, age: 25, city: Narayanganj, country: Bangladesh}
xxxxxxxxxx
Map someThing = {
"someThing2":{
'key1': 'val1',
'key2': 'val2',
'key3': {},
}
};
// {someThing2: {key1: val1, key2: val2, key3: {}}}
someThing['someThing2']['key3'] = {
'someThing3': {
'key4': 'val4',
},
};
// {someThing2: {key1: val1, key2: val2, key3: {someThing3: {key4: val4}}}}
xxxxxxxxxx
void main() {
var details = {'Usrname':'tom','Password':'pass@123'};
details['Uid'] = 'U1oo1';
print(details);
}
xxxxxxxxxx
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(),
),
),
],
),
],
);
}
xxxxxxxxxx
import 'package:map_launcher/map_launcher.dart';
if (await MapLauncher.isMapAvailable(MapType.google)) {
await MapLauncher.showMarker(
mapType: MapType.google,
coords: coords,
title: title,
description: description,
);
}