android - 使用 google_maps_autocomplete 后 Flutter 无法运行
问题描述
我从 flutter_google_places_autocomplete 复制了这段代码,但我的应用程序无法启动更多。
我怎么解决这个问题?
import 'package:flutter/material.dart';
import 'package:flutter_google_places_autocomplete/flutter_google_places_autocomplete.dart';
import 'package:flutter_prayer_times/place_search_banner_field.dart';
// Google Api Key
const googleMapsApiKey = "......";
// to get places detail (lat/lng)
GoogleMapsPlaces _places = GoogleMapsPlaces(apiKey: googleMapsApiKey);
Launching lib\main.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDebug'...
Kotlin plugin should be enabled before 'kotlin-android-extensions'
Compiler message:
file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_google_places_autocomplete-0.1.0/lib/src/flutter_google_places_autocomplete.dart:327:35: Error: Too many positional arguments: 0 allowed, but 1 found.
Try removing the extra positional arguments.
_places = new GoogleMapsPlaces(widget.apiKey);
^
file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/google_maps_webservice-0.0.14/lib/src/places.dart:22:3: Context: Found this candidate, but the arguments don't match.
GoogleMapsPlaces({
^
Compiler failed on C:\Users\GaminKh\Desktop\MyProjects\prayertimes\flutter_prayer_times\lib\main.dart
Finished with error: Gradle task assembleDebug failed with exit code 1
解决方案
flutter_google_places_autocomplete
已弃用,您应该使用flutter_google_places
. 检查此链接以获取完整答案。
推荐阅读
- javascript - 使 Vueper-Slides 与 Gridsome 中的 Markdown 前端工作一起使用
- r - 边列表网络图 R
- python - 即使您关闭文件并重新启动计算机,变量也会存储其值?
- sql-server - 将 select 语句的结果作为参数传递给存储过程
- python - 在 Windows 上的 emacs 中运行的 Anaconda Python 中使用 numpy
- html - Webfont 渲染问题:浏览器似乎对大小和位置感到困惑
- authentication - OWIN 自托管客户端证书认证 403
- python - 在 Flask 中使用 POST 方法发送数组
- python - 如何在 python (in Mu) 中导入已安装的库?
- algorithm - 用 k 1s 获得所有二进制组合的高效算法