fromMap static method
Implementation
static AutoSuggestResponse fromMap(Map<String, dynamic> map) {
AutoSuggestResponse autoSuggestResponse = AutoSuggestResponse();
if (map.containsKey("suggestedLocations")) {
List<dynamic> suggestedLocations =
map['suggestedLocations'] as List<dynamic>;
autoSuggestResponse.suggestedLocations =
List.generate(suggestedLocations.length, (index) {
return ELocation.fromMap(
suggestedLocations[index] as Map<String, dynamic>);
});
}
if (map.containsKey("userAddedLocations")) {
List<dynamic> userAddedLocations =
map['userAddedLocations'] as List<dynamic>;
autoSuggestResponse.userAddedLocations =
List.generate(userAddedLocations.length, (index) {
return ELocation.fromMap(
userAddedLocations[index] as Map<String, dynamic>);
});
}
if (map.containsKey("suggestedSearches")) {
List<dynamic> userAddedLocations =
map['suggestedSearches'] as List<dynamic>;
autoSuggestResponse.suggestedSearches =
List.generate(userAddedLocations.length, (index) {
return SuggestedSearch.fromMap(
userAddedLocations[index] as Map<String, dynamic>);
});
}
return autoSuggestResponse;
}