小编Tuq*_*qay的帖子

插件项目:location_web 未找到。请更新 settings.gradle。我该如何解决?

我在我的 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

47
推荐指数
2
解决办法
4万
查看次数

在模块中发现重复的类 com.google.android.gms.internal.vision.zze

我正在尝试使用 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)

android android-gradle-plugin firebase-mlkit

23
推荐指数
2
解决办法
1万
查看次数

我应该将 fetch() 与 .then 一起使用还是 async/await

以下代码片段给了我相同的结果。使用.thenasync/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)

javascript fetch promise async-await

7
推荐指数
1
解决办法
5524
查看次数

无效参数:URI 中未指定主机 - Image.network

我正在构建一个应用程序,在其中我从 api 获取图像 url 并将其显示给用户。这是我的代码:

\n
 Image.network(\n               news.urlToImage ??\n               defaultPlaceholderImageUrl,\n                      ),\n
Run Code Online (Sandbox Code Playgroud)\n

Api 有时不提供 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\n
Run Code Online (Sandbox Code Playgroud)\n

链接在浏览器中有效。但不是在应用程序中。我该如何解决这个问题?

\n

host flutter

4
推荐指数
1
解决办法
5万
查看次数

在 kotlin 中获取两个或多个整数中的最小值的最快方法是什么?

我有两个整数,例如val a = 5val 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)

你能告诉我哪个更快,为什么那个更快?

kotlin

3
推荐指数
1
解决办法
6459
查看次数