Google Places API in Flutter
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");
sainu
I just started my career as asp.net programmer. And I am Eager to study new.
Updated on December 13, 2022Comments
-
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
version0.2.3
.-
CopsOnRoad over 4 yearsDoes import also show error?
-
sainu over 4 years@CopsOnRoad no, it's fine.
-
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 over 4 yearslet me check with the example
-
Hayi Nukman over 4 yearsyour code snippet is similar to this: github.com/fluttercommunity/flutter_google_places/blob/master/… ,, so I thought it's the same problem....
-
Darshan over 4 yearsAs @HayiNukman mentioned, you need to import
google_maps_webservice packages
to be able to useGoogleMapPlaces
class, as it extends fromGoogleWebServices
. The package that you importedflutter_google_places
is used to leverage the autocomplete field and the places. -
user254694 about 4 yearsAs 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.