A Flutter widget that integrates with the flutter_google_places_sdk and google_maps_flutter to provide a search input field with Google Places autocomplete and LatLng callback support. Ideal for apps that need smooth location search functionality.

Features

  • Google Places autocomplete integration
  • Real-time search with debouncing
  • Customizable input decoration and text style
  • Easy retrieval of selected location's coordinates (LatLng)
  • Clean overlay UI with search suggestions

Getting started

Prerequisites

  1. Enable the Places API and Maps SDK for Android/iOS in Google Cloud Console.
  2. Add your API key with the required restrictions.

Installation

In your pubspec.yaml, add:

dependencies:
  flutter:
    sdk: flutter

  # Add the latest version
  flutter_google_places_sdk:

  # Add the latest version
  google_maps_flutter:

  # This package (use latest)
  google_places_search_field:

Preview

Google Places Search Field Screen Shot

Platform Support

Platform Supported
Android ✅ Yes
iOS ✅ Yes
Web ❌ No
macOS ⚠️ Untested
Windows ⚠️ Untested
Linux ⚠️ Untested

❗️ This package does not support Flutter Web due to limitations in flutter_google_places_sdk and google_maps_flutter. Consider using google_maps_webservice or a platform-channel implementation for web-specific use cases.

Usage

GooglePlacesSearchField(
  apiKey: 'YOUR_GOOGLE_API_KEY',
  onLatLngSelected: (LatLng latLng) {
    print('Selected location: ${latLng.latitude}, ${latLng.longitude}');
  },
  hintText: 'Search for a place',
);