【发布时间】:2019-07-12 19:18:29
【问题描述】:
我正在使用 aws_ai 插件,响应的形式为
instance of Future<String>
我阅读了下面给出的回复。我需要使用键“confidence”从 json 访问特定值,如何访问它?
Future main1() async {
File sourceImagefile; //load source image in this File object
String accessKey = "",
secretKey = "",
region = "" ;
RekognitionHandler rekognition = new RekognitionHandler(accessKey, secretKey, region);
if(sourceImagefile !=null && targetImagefile !=null) {
Future<String> labelsArray = rekognition.compareFaces(
sourceImagefile, targetImagefile);
print(labelsArray);
return labelsArray.toString();
}else{
return "Enter Image";}
}
___________________________________
(later in widget build:)
___________________________________
onpressed(){
main1().then((labelsArray){
print("json value is: "+labelsArray);
});
}
目前的结果是:
json value is: Instance of 'Future<String>'
感谢您的帮助!
【问题讨论】:
-
能否提供更详细的代码。
-
确定我编辑了问题
-
看看应该能解决的答案
标签: json string flutter dart future