> ## Documentation Index
> Fetch the complete documentation index at: https://docs.baato.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Autocomplete

> Build a search-as-you-type place picker in Flutter.

<Note>
  Before you begin, please make sure you have the [Baato Flutter Library](/libraries/flutter) installed in your app.
</Note>

<Frame caption="Place suggestions in a Flutter app">
  <img src="https://mintcdn.com/baato/3GUKEGLT42m2snov/images/flutter/autocomplete.png?fit=max&auto=format&n=3GUKEGLT42m2snov&q=85&s=5bf6f4355a2e56ae696d7d64dca3cc49" alt="Search-as-you-type place suggestions in a Flutter app" width="2208" height="1242" data-path="images/flutter/autocomplete.png" />
</Frame>

### Autocomplete search

The BaatoPlaceAutoSuggestion widget is integrated with the Baato API to provide location suggestions as per the query.

Below is a complete example demonstrating the implementation of auto-suggestion.

```dart theme={null}
  Widget build(BuildContext context) {
    return Padding(
          padding: const EdgeInsets.all(16.0),
          child: BaatoPlaceAutoSuggestion(
            hintText: 'Search for a place',
            onPlaceSelected: (suggestion) {},
            currentCoordinate: BaatoCoordinate(
              latitude: 27.7172,
              longitude: 85.3240,
            ),
            suggestionsHeader: Container(
              color: Colors.white.withOpacity(0.8),
              child: Text('Suggestions'),
            ),
            suggestionsFooter: Container(
              color: Colors.white.withOpacity(0.8),
              child: Text('Footer'),
            ),
            inputDecoration: InputDecoration(
              border: OutlineInputBorder(),
              enabledBorder: OutlineInputBorder(
                borderSide: BorderSide(color: Colors.grey),
              ),
            ),
            onPlaceDetailsRetrieved: (place) {
              BaatoMapView.mapController.cameraManager?.moveTo(
                BaatoCoordinate(
                  latitude: place.centroid.latitude,
                  longitude: place.centroid.longitude,
                ),
              );
            },
          ),
        )
      }
```

<Card title="View the full example on GitHub" icon="github" href="https://github.com/baato/baato-flutter-maplibre-demo/blob/main/lib/ui/baato_search.dart" horizontal />
