Google Places API in Flutter

8,594

Solution 1

GoogleMapPlaces is available on different library, not in flutter_google_places...

it's available on https://pub.dev/packages/google_maps_webservice

Solution 2

you can find another package for google place google_place

var googlePlace = GooglePlace("Your-Key");
var result = await googlePlace.autocomplete.get("1600 Amphitheatre");
Share:
8,594
sainu
Author by

sainu

I just started my career as asp.net programmer. And I am Eager to study new.

Updated on December 13, 2022

Comments

  • sainu
    sainu over 1 year

    I am working on google places API with Flutter. I am working by referring the example. But I got errors for google places API classes as

    Eg:

    Undefined class 'GoogleMapsPlaces'. Try changing the name to the name of an existing class, or creating a class with the name

    I imported the flutter_google_places in my dart file as:

    import 'package:flutter_google_places/flutter_google_places.dart'; But still I got the error for all classes.

    Using flutter_google_places version 0.2.3.

    enter image description here

    • CopsOnRoad
      CopsOnRoad over 4 years
      Does import also show error?
    • sainu
      sainu over 4 years
      @CopsOnRoad no, it's fine.
    • sainu
      sainu over 4 years
      @CopsOnRoad no, actually the import import 'package:flutter_google_places/flutter_google_places.dart'; is greyed out and showing unused import.
  • sainu
    sainu over 4 years
    let me check with the example
  • Hayi Nukman
    Hayi Nukman over 4 years
    your code snippet is similar to this: github.com/fluttercommunity/flutter_google_places/blob/maste‌​r/… ,, so I thought it's the same problem....
  • Darshan
    Darshan over 4 years
    As @HayiNukman mentioned, you need to import google_maps_webservice packages to be able to use GoogleMapPlaces class, as it extends from GoogleWebServices. The package that you imported flutter_google_places is used to leverage the autocomplete field and the places.
  • user254694
    user254694 about 4 years
    As a general rule you should describe why this one is better or probably even why you think this will solve the problem the poster has, as part of that it would probably also be beneficial to describe why the original package has the particular problem, otherwise your suggestion seems like flail around trying packages until something works. which is probably not the strategy you actually want them to pursue.