我是第一次开发Flutter应用程序..我在添加图像时遇到了问题.我有以下问题:
我尝试了什么:
assets:
- images/lake.jpg
Run Code Online (Sandbox Code Playgroud)
在pubspec.ymal里面:
完整档案:
name: my_flutter_app
description: A new Flutter application.
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^0.1.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter:
uses-material-design: true,
assets:
- images/lake.jpg
Run Code Online (Sandbox Code Playgroud)
错误日志:
#/properties/flutter/properties/uses-material-design: type: wanted [boolean] got true,
Error detected in pubspec.yaml:
Error building assets
FAILURE: Build failed with an exception.
* Where:
Script '/home/abc/Downloads/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 435
* What went wrong:
Execution failed for task ':app:flutterBuildDebug'.
> Process 'command '/home/abc/Downloads/flutter/bin/flutter'' finished with non-zero exit value 1
* Try: …Run Code Online (Sandbox Code Playgroud) 我已经react-native-material-dropdown在我的 React Native 项目中使用了。我正在从 获取数据API。
问题是我在下拉列表中成功获取名称,但我想要一个hotelId所选名称。我无法解析JSON下拉列表中的整体。
JSON:
{
"message": "Success",
"notificationCount": 0,
"result": [{
"hotelId": "india3c71a2b8-05d3-476e-825a-f31e08ac3bdc",
"name": "Hotel Samrat"
}, {
"hotelId": "indiae4ef0d05-f46e-48f3-9bce-a37bfde089a4",
"name": "Hotel Kalinga Ashok"
}],
"status": 1,
"totalRecord": 2,
"scopeId": ""
}
Run Code Online (Sandbox Code Playgroud)
我已经通过以下方式解析了数据:
var count = Object.keys(responseJSON.result).length;
let drop_down_data = [];
for (var i = 0; i < count; i++) {
console.log(responseJSON.result[i].name) // I need to add
drop_down_data.push({ value: responseJSON.result[i].name }); // Create your array of data
} …Run Code Online (Sandbox Code Playgroud)