DaData Service Integration for Address Hints in Mobile Apps
Google Places Autocomplete works well in Europe and USA. In Russia—worse: unfamiliar buildings, addresses like "1A", addresses in industrial zones, garden communities. DaData solves this: their database built on FIAS/KLADR knows Russian address space much deeper.
What We Integrate
Main endpoint for hints on input: POST https://suggestions.dadata.ru/suggestions/api/4_1/rs/suggest/address. Request body—JSON with query field (entered string) and optional locations for region limitation. Response contains suggestions array, each with value (full address), data.geo_lat, data.geo_lon, data.house, data.street, data.city_with_type.
Second endpoint—reverse geocoding by coordinates: POST .../geolocate/address with lat/lon and radius_meters. Handy as fallback to Google Reverse Geocoding for Russian addresses.
iOS Implementation
Create DaDataService with URLSession or Alamofire. Authorization via Authorization: Token <API_KEY> header. Store key in xcconfig and read via Bundle.main.infoDictionary—don't hardcode.
Show hints in UITableView under text field. Debounce requests via Combine: searchSubject.debounce(for: .milliseconds(300), scheduler: RunLoop.main). Without debounce, fast input creates request per character.
Sample response handling:
struct DaDataSuggestion: Decodable {
let value: String
let data: DaDataAddress
}
struct DaDataAddress: Decodable {
let geoLat: String?
let geoLon: String?
let city: String?
let street: String?
let house: String?
enum CodingKeys: String, CodingKey {
case geoLat = "geo_lat"
case geoLon = "geo_lon"
case city, street, house
}
}
Important: geo_lat and geo_lon arrive as String, not Double. Convert via Double(geoLat ?? "") with nil check.
Android Implementation
Retrofit interface with @POST and @Header("Authorization"). Coroutine in ViewModel, StateFlow<List<DaDataSuggestion>> for UI. Debounce via Flow.debounce(300) in collectLatest.
In compose project LazyColumn under TextField with DropdownMenuItem or custom Popup. Managing focus important: on suggestion selection remove focus via LocalFocusManager.current.clearFocus() and hide keyboard via LocalSoftwareKeyboardController.
Flutter
No DaData package on pub.dev with good rating—write custom DaDataRepository with Dio. Return hints via StreamController with debounce Timer(Duration(milliseconds: 300), ...). For UI—ListView.builder in Overlay or flutter_typeahead package with custom suggestionsCallback.
Important Notes
Free plan quota—10,000 requests per day. For apps with active audience this runs out first week. Plan quota on architecture stage.
On initial page load—don't request hints for empty string, wastes quota. Minimum query length—3 characters.
Integration timeline: one-two days. Includes client service, UI component with debounce, selection handling and coordinate mapping.







