BloomDeepLinksConfig.fromMap constructor
BloomDeepLinksConfig.fromMap(
- Map map
Constructs a BloomDeepLinksConfig from a configuration map.
Implementation
factory BloomDeepLinksConfig.fromMap(Map<dynamic, dynamic> map) {
final schemesList = map['schemes'] is List ? List<String>.from(map['schemes']) : <String>[];
final domainsList = <String>[];
if (map['domains'] is List) {
for (final d in map['domains']) {
if (d is String) domainsList.add(d);
if (d is Map && d['host'] != null) domainsList.add(d['host'].toString());
}
}
final mappings = <String, String>{};
if (map['routes'] is Map) {
map['routes'].forEach((k, v) => mappings[k.toString()] = v.toString());
}
return BloomDeepLinksConfig(
enabled: map['enabled'] is bool ? map['enabled'] as bool : false,
schemes: schemesList,
domains: domainsList,
routeMappings: mappings,
);
}