我在我的 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";
}
}
Run Code Online (Sandbox Code Playgroud)
它抛出以下错误消息:
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'
Run Code Online (Sandbox Code Playgroud)
我收到上述错误消息的区域在我的代码中:
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 …Run Code Online (Sandbox Code Playgroud) google-maps-api-3 dart flutter flutter-dependencies flutter-web
我正在尝试使用 openCV 和 Firebase ML Kit 构建一个应用程序。但是在构建项目时出现以下错误:
Duplicate class com.google.android.gms.internal.vision.zze found in modules jetified-play-services-vision-20.0.0-runtime.jar (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime.jar (com.google.android.gms:play-services-vision-common:19.1.0)
Duplicate class com.google.android.gms.internal.vision.zzf found in modules jetified-play-services-vision-20.0.0-runtime.jar (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime.jar (com.google.android.gms:play-services-vision-common:19.1.0)
Duplicate class com.google.android.gms.internal.vision.zzg found in modules jetified-play-services-vision-20.0.0-runtime.jar (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime.jar (com.google.android.gms:play-services-vision-common:19.1.0)
Duplicate class com.google.android.gms.internal.vision.zzh found in modules jetified-play-services-vision-20.0.0-runtime.jar (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime.jar (com.google.android.gms:play-services-vision-common:19.1.0)
Duplicate class com.google.android.gms.internal.vision.zzi found in modules jetified-play-services-vision-20.0.0-runtime.jar (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime.jar (com.google.android.gms:play-services-vision-common:19.1.0)
Duplicate class com.google.android.gms.internal.vision.zzv found in modules jetified-play-services-vision-20.0.0-runtime.jar (com.google.android.gms:play-services-vision:20.0.0) and jetified-play-services-vision-common-19.1.0-runtime.jar (com.google.android.gms:play-services-vision-common:19.1.0)
Duplicate class com.google.android.gms.internal.vision.zzw found in modules jetified-play-services-vision-20.0.0-runtime.jar …Run Code Online (Sandbox Code Playgroud) 以下代码片段给了我相同的结果。使用.then和async/await来获取数据有什么区别?
// Code 1
function fetchData() {
fetch(url)
.then(response => response.json())
.then(json => console.log(json))
}
// Code 2
async function fetchData() {
const response = await fetch(url);
const json = await response.json();
console.log(json);
}
Run Code Online (Sandbox Code Playgroud) 我正在构建一个应用程序,在其中我从 api 获取图像 url 并将其显示给用户。这是我的代码:
\n Image.network(\n news.urlToImage ??\n defaultPlaceholderImageUrl,\n ),\nRun Code Online (Sandbox Code Playgroud)\nApi 有时不提供 url,所以我显示占位符图像,这部分工作正常。但我使用提供的网址之一收到以下错误:
\n\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90 Exception caught by image resource service \xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\xe2\x95\x90\nInvalid argument(s): No host specified in URI https:////m.files.bbci.co.uk/modules/bbc-morph-sport-seo-meta/1.20.8/images/bbc-sport-logo.png\nRun Code Online (Sandbox Code Playgroud)\n该链接在浏览器中有效。但不是在应用程序中。我该如何解决这个问题?
\n我有两个整数,例如val a = 5和val b = 7。我只是好奇计算这些整数的最小值的最快方法是什么。
val min = minOf(a,b)
Run Code Online (Sandbox Code Playgroud)
val min = Math.min(a,b)
Run Code Online (Sandbox Code Playgroud)
val min = if(a<b) a else b
Run Code Online (Sandbox Code Playgroud)
你能告诉我哪个更快,为什么那个更快?
flutter ×2
android ×1
async-await ×1
dart ×1
fetch ×1
flutter-web ×1
host ×1
javascript ×1
kotlin ×1
promise ×1