List<Integer> listOne= new ArrayList<>();
listOne.add(10);
listOne.add(2);
listOne.add(3);
//Second Array
List<Integer> listTwo= new ArrayList<>();
listTwo.add(3);
listTwo.add(7);
listTwo.add(1);
Run Code Online (Sandbox Code Playgroud)
我想比较两个 List 并指出listOne或listTwo取决于哪个值更大
[10, 2, 3] compare to [3, 7, 1]
if listOne.get(0) > listTwo.get(0) //add one point to listOne
if listOne.get(0) < listTwo.get(0) //add one point to listTwo
Run Code Online (Sandbox Code Playgroud)
这是我测试过的代码
static List<Integer> compareList(List<Integer> a, List<Integer> b) {
ArrayList<Integer> output = new ArrayList<>();
output.add(0, 0);
output.add(1, 0);
int out = output.get(0);
int out2 = output.get(1);
for (int i = 0; i …Run Code Online (Sandbox Code Playgroud) 当我尝试加载从图库中选择的图像以在首次运行时显示在我的应用程序上时,会出现此错误。
======== Exception caught by image resource service ================================================
The following assertion was thrown resolving an image codec:
Unable to load asset: /data/user/0/com.example.app_test/cache/image_picker5494866148665379741.jpg
When the exception was thrown, this was the stack:
#0 PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:225:7)
<asynchronous suspension>
#1 AssetBundleImageProvider._loadAsync (package:flutter/src/painting/image_provider.dart:668:31)
#2 AssetBundleImageProvider.load (package:flutter/src/painting/image_provider.dart:651:14)
#3 ImageProvider.resolveStreamForKey.<anonymous closure> (package:flutter/src/painting/image_provider.dart:504:13)
...
Image provider: ExactAssetImage(name: "/data/user/0/com.example.app_test/cache/image_picker5494866148665379741.jpg", scale: 1.0, bundle: null)
Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#d8a39(), name: "/data/user/0/com.example.versus_pay_client/cache/image_picker5494866148665379741.jpg", scale: 1.0)
====================================================================================================
Run Code Online (Sandbox Code Playgroud)
当我热重新加载应用程序时,会显示图像。
Future getImage() async {
pickedFile = await picker.getImage(source: ImageSource.gallery);
setState(() {
if (pickedFile != …Run Code Online (Sandbox Code Playgroud)