GeocodeResponse.fromMap constructor

GeocodeResponse.fromMap(
  1. Map<String, dynamic> map
)

Implementation

factory GeocodeResponse.fromMap(Map<String, dynamic> map) {
  final results = <Address>[];

  final jResults = map['results'] as List;
  if (jResults.isNotEmpty) {
    for (final item in jResults) {
      final address = Address.fromMap(item);
      results.add(address);
    }
  }

  return GeocodeResponse._(
    status: ResponseStatus.fromValue(map['status']),
    errorMessage: map['error_message'],
    results: results,
  );
}