backgroundColor=['red','green','blue','orange'][Math.floor(Math.random()*4)]
Run Code Online (Sandbox Code Playgroud)
有人可以解释一下这段代码是如何在 Javascript 语法中执行的,我知道它会生成一个随机数,但结果是第二个方括号中生成的索引值中的颜色。
在 C++ 中,array[][] 用于生成二维数组,但在这里它生成要在第一个方括号对中使用的索引。
希望得到关于代码执行如何发生的澄清
LATLNG 给出参数类型“LatLng”无法分配给参数类型“LatLng”
参数类型“LatLng(其中 LatLng 在 E:\flutter.pub-cache\hosted\pub.dartlang.org\latlong2-0.8.0\lib\latlong\LatLng.dart 中定义)”无法分配给参数类型'LatLng(其中LatLng在E:\flutter.pub-cache\hosted\pub.dartlang.org\latlong-0.6.1\lib\latlong\LatLng.dart中定义)'
以下是已注释掉的未使用的依赖项。
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
font_awesome_flutter: ^8.11.0
flutter:
sdk: flutter
firebase_core: ^0.7.0
firebase_analytics: ^7.0.1
firebase_auth: ^0.20.0+1
cloud_firestore: ^0.16.0
firebase_storage: ^7.0.0
readmore: ^2.0.0
google_fonts: ^1.1.1
google_sign_in: "^4.5.1"
flutter_login_facebook: ^0.4.2+3
# mapbox_gl: ^0.10.0
location: ^4.3.0
provider: ^4.3.3
image_picker: ^0.6.7+3
image_cropper: ^1.4.0
shared_preferences: ^0.5.3+4
# geolocator: 6.2.1
intl: ^0.16.1
http: ^0.12.0+2
geocoding: ^2.0.0
# geocoder: ^0.2.1
flutter_map: ^0.12.0
# latlong: ^0.8.0
# geoflutterfire: ^2.2.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: ^0.8.1
Run Code Online (Sandbox Code Playgroud)