google_maps_place_search_advance

Pub Dev

Custom Google search places autocomplete widget with landmark images and distance calculation.

πŸ‘‹ Get started

google_maps_place_search_advance provides programmatic access to Google's database for the place autocomplete search and also their landmark images, as well as distance with respect to the device's current place.

πŸ’‘ Features

Help your customers explore where they are and what’s around them:

  • Place Autocomplete automatically fills in the name and/or address of a place as users type.
  • Place Geolocator gives the distance with respect to current position.
  • Place Photos returns high-quality images of a place.

πŸš€ Installation

Add dependency

You can use the command to add google_maps_place_search_advance as a dependency with the latest stable version:

$ dart pub add google_maps_place_search_advance

Or you can manually add google_maps_place_search_advance into the dependencies section in your pubspec.yaml:

dependencies:
  google_maps_place_search_advance: ^replace-with-latest-version

Add image for the icon to appear it is required in the package to work.

flutter:
  # To add assets to your package, add an assets section, like this:
  assets:
    - assets/search.png

The latest version is: Pub The latest version including pre-releases is: Pub

Before you upgrade: Breaking changes might happen in major and minor versions of packages.
See the Migration Guide for the complete breaking changes list.

Super simple to use

import 'package:google_maps_place_search_advance/google_maps_place_search_advance.dart';

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        body: Container(
          child: SingleChildScrollView(
            child: GooglePlaceSearchAdvance(
              googleMapsApiKey: "GOOGLE_MAPS_API_KEY",
              country: "fr",
              iconImagePath: "assets/search.png",
              mapimagePath: "assets/not_image_place.png",
              onLocationSelected: (double lat, double lng, String address, String imageURL){
                print("Coordinates are $lat,$lng");
                print("Address is : $address");
                print("Image URL is: $imageURL");
              },
            ),
          ),
        ),
      ),
    );
  }
}
    

πŸ”‘ Generate App key

  1. Go to the Google Maps Platform > Credentials page.
  2. On the Credentials page, click Create credentials > API key. The API key created dialog displays your newly created API key.
  3. Click Close.The new API key is listed on the Credentials page under API keys.(Remember to restrict the API key before using it in production.)

πŸ‘¨β€πŸ’» Developer Details

GitHub Icon LinkedIn Icon