Flutter谷歌地图弹出“The Provided Api Key is invalid”错误的问题求助
Flutter谷歌地图弹出“The Provided Api Key is invalid”错误的问题求助
大家好,我最近在开发Flutter应用时遇到了个棘手的问题:我做了一个地点选择页面,集成谷歌地图相关功能后,一直弹出**“The Provided Api Key is invalid”**的错误提示。以下是这个地点选择页面的代码,麻烦各位帮忙看看哪里出问题了,或者给我一些排查方向👇
class EventLocationPicker extends StatefulWidget { final String locationPlaceId; EventLocationPicker({required this.locationPlaceId}); EventLocationPickerState createState() => EventLocationPickerState(locationPlaceId: locationPlaceId); } class EventLocationPickerState extends State<EventLocationPicker> { String locationPlaceId; String originalLocationPlaceId; EventLocationPickerState({required this.locationPlaceId}) : originalLocationPlaceId = locationPlaceId; final Completer<GoogleMapController> _controller = Completer(); final GoogleGeocodingApi geoCoding = GoogleGeocodingApi(globals.GOOGLE_API_KEY); String locationAddress = ""; String hintText = "Search for a location"; LatLng startingPosition = LatLng(37.7749, -122.4194); Set<Marker> markers = {...
我自己初步排查了一下,确认代码里引用的globals.GOOGLE_API_KEY是直接复制自谷歌云控制台的密钥,但错误还是持续出现。目前还没仔细核对所有需要启用的API服务,也不确定是不是平台端(Android/iOS)的密钥配置出了问题。
有没有大佬能分享下常见的排查步骤,或者从我的代码里看出什么可能的问题吗?
备注:内容来源于stack exchange,提问作者Nico Foth
相关产品推荐
相关产品推荐

