在图像已上传或未上传之后,我无法使用浮动代码返回到特定路线。它会继续加载,不会返回指定的路线。
我尝试了很多方法,但是在我猜想的小部件之间传递状态时存在一些问题。
void getVideo() async {
File file = await ImagePicker.pickVideo(source: ImageSource.gallery);
if (file != null) {
String fileName = basename(file.path);
try {
String response =
await UploadEventRepository().getPreassigned(fileName);
var res = await UploadEventRepository().uploadEventToS3(
response,
file.readAsBytesSync(),
{HttpHeaders.contentTypeHeader: 'video/quicktime'});
if (res.statusCode == 200) {
setState(() {
isUploaded = true;
progressString = 'Upload Completed';
});
} else {
setState(() {
progressString = 'error occurred.';
});
}
} catch (e) {
throw (e);
}
}
}