fetchMatchingPlaces method
Implementation
Future<List<Place>?> fetchMatchingPlaces() async {
try {
final _response = await dio.get(url);
if (_response.data != null) {
final _json = jsonDecode(_response.toString());
List<dynamic> _features = _json['features'] as List<dynamic>;
List<Place> _placesArray = _features.map(
(_featureMap) {
return Place.fromMap(_featureMap);
},
).toList(growable: false);
return _placesArray;
}
} on DioError catch (dioError) {
throw NetworkException.fromDioError(dioError);
}
}