I'm developing my first more complex project, similar to the Uber app idea.
I follow the instructions in this question autocomplete with flutter
But when i try to search for addresses, nothing appears
I'm using GetX for state management
Here's my code, in the view:
child: TextField(
onTap: () async {
Prediction p = await PlacesAutocomplete.show(
context: Get.context,
apiKey: "my_apikey_is_here",
language: "pt",
components: [Component(Component.country, "br")],
mode: Mode.overlay);
controller.displayPrediction(p);
},
controller: _controllerDestino,
decoration: InputDecoration(
icon: Container(
margin: EdgeInsets.only(left: 10),
child: Icon(
Icons.local_taxi,
color: Colors.black,
),
),
hintText: "Digite o destino",
border: InputBorder.none),
)
Method and statements in the controller:
static const kGoogleApiKey = "my_ApiKey_isHere";
GoogleMapsPlaces places = GoogleMapsPlaces(apiKey: kGoogleApiKey);
Future<Null> displayPrediction(Prediction p) async {
if (p != null) {
PlacesDetailsResponse detail =
await places.getDetailsByPlaceId(p.placeId);
var placeId = p.placeId;
double lat = detail.result.geometry.location.lat;
double lng = detail.result.geometry.location.lng;
var address = await Geocoder.local.findAddressesFromQuery(p.description);
print(lat);
print(lng);
update();
}
}
On Google Cloud Platform, 100% of my requests for Api Places result in errors, as shown in the image below
I saw some forums saying that I was obliged to link the project with a billing account, I did it, but the problem persisted
If someone can help me, thank you in advance