作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在我的 android flutter 应用程序中使用了 google maps api 和 location pub,dev 包,并尝试使用 api 中的 url 调出图像。
这是带有一些代码的网址:
class LocationHelper{
static String mapviewpointer({double latitude, double longitude}){
return "https://maps.googleapis.com/maps/api/staticmap?center=$latitude,$longitude&zoom=13&size=600x300&maptype=roadmap&markers=color:pink%7Clabel:C%7C$latitude,$longitude&key=$GOOGLE_API_KEY";
}
}
它抛出以下错误消息:
Plugin project :location_web not found. Please update settings.gradle;
我不知道如何解决这个错误。
I/flutter (21880): Invalid argument(s): No host specified in URI file:///Instance%20of%20'Future%3CString%3E'
我收到上述错误消息的区域在我的代码中:
Future <String> _getUserLocation() async{
final locData = await Location().getLocation();
final staticMapUrl = LocationHelper.mapviewpointer(
latitude: locData.latitude,
longitude: locData.longitude,
);
return staticMapUrl;
}
final mapview = _getUserLocation();
class NearbyScreen extends StatelessWidget {
@override
//LocationHelper.mapviewpointer(latitude: )
Widget build(BuildContext context) {
return Column(
children: <Widget>[
Container(height:170, width: double.infinity,
child:Image.network(mapview.toString())
),
Text("hello"),
],
);
}
}
这与我返回
Future<String>
的事实有关吗?而不仅仅是
string
在我的
_getUserlocation
功能?我怎么能解决这个问题?
最佳答案
使用以下 settings.gradle
:
include ':app'
def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
def plugins = new Properties()
def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
if (pluginsFile.exists()) {
pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
}
plugins.each { name, path ->
def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
include ":$name"
project(":$name").projectDir = pluginDirectory
}
.flutter-plugin
将包含插件及其路径的文件。
关于flutter - 插件项目 :location_web not found. 请更新 settings.gradle。我该如何解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62348554/
我在运行我的应用程序时遇到问题,它说: 插件项目:location_web找不到。请更新settings.gradle。 我看了一些视频,但关于此的任何内容:/ Settings.gradle inc
我在我的 android flutter 应用程序中使用了 google maps api 和 location pub,dev 包,并尝试使用 api 中的 url 调出图像。 这是带有一些代码的网
我是一名优秀的程序员,十分优秀!