Search packages, repositories and app categories

Package detailsv2.1.1

google_places_flutter

Custom Google places autocomplete widget for Android and iOS both. Use https://pub.dev/packages/google_places_flutter

AndroidiOSWebmacOSWindowsLinux
30-day downloads
94.4K
Likes
100
Pub points
130

Install package

flutter pub add google_places_flutter

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A customizable Google Places autocomplete widget for Flutter apps on Android, iOS, Web, macOS, Windows, and Linux. It enables users to search for locations with real-time suggestions powered by the Google Places API. The package simplifies integration of place selection into forms or maps, offering a seamless experience across platforms. Developers can customize appearance, handle place selections, and manage location queries efficiently. Ideal for applications requiring address input, location-based services, or geocoding features.

Use cases

  • Address input in forms
  • Location-based app features
  • Geocoding and map integration
  • Travel and delivery apps
  • User profile location setup
  • Event location selection

Key features

  • Real-time place suggestions
  • Cross-platform support
  • Customizable UI
  • Place details retrieval
  • Easy API integration
  • Supports multiple platforms

Suitable for

  • Mobile and web apps needing location search
  • Developers using Google Places API
  • Apps requiring accurate address input
  • Location-aware applications
  • Teams building cross-platform solutions

Considerations

  • Requires Google Places API key
  • May incur usage costs
  • Depends on internet connectivity
  • Limited customization of autocomplete dropdown
  • Potential latency in suggestions
  • Needs proper error handling for API failures

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

google_places_flutter

Add dependency into pubspec.yml

dependencies:
  flutter:
    sdk: flutter
  google_places_flutter: <last-version>
  

Google AutoComplete TextField Widget code

    GooglePlaceAutoCompleteTextField(
        textEditingController: controller,
        googleAPIKey: "YOUR_GOOGLE_API_KEY",
        inputDecoration: InputDecoration()
        debounceTime: 800 // default 600 ms,
        countries: ["in","fr"],// optional by default null is set
        isLatLngRequired:true,// if you required coordinates from place detail
        getPlaceDetailWithLatLng: (Prediction prediction) {
         // this method will return latlng with place detail
        print("placeDetails" + prediction.lng.toString());
        }, // this callback is called when isLatLngRequired is true
        itemClick: (Prediction prediction) {
         controller.text=prediction.description;
          controller.selection = TextSelection.fromPosition(TextPosition(offset: prediction.description.length));
        }
        // if we want to make custom list item builder
        itemBuilder: (context, index, Prediction prediction) {
          return Container(
            padding: EdgeInsets.all(10),
            child: Row(
              children: [
                Icon(Icons.location_on),
                SizedBox(
                  width: 7,
                ),
                Expanded(child: Text("${prediction.description??""}"))
              ],
            ),
          );
        }
        // if you want to add seperator between list items
        seperatedBuilder: Divider(),
        // want to show close icon 
        isCrossBtnShown: true,
        // optional container padding
         containerHorizontalPadding: 10,
         // place type
        placeType: PlaceType.geocode,
        // keyboard type (defaults to TextInputType.streetAddress)
        keyboardType: TextInputType.text, // optional - defaults to streetAddress for better address input
         
         
        
        
    )
    

Customization Option

You can customize a text field input decoration and debounce time

Screenshorts

Categories

Dependencies

Dependency list 2 items

Source repository

Projects using this package

No data available yet.

Rankings