flutter

上传头像
Future getImage() async { var image = await ImagePicker.pickImage(source: ImageSource.gallery); ItemDao.UpLoad(image).then((res){ if(res['resultCode'] == 'ok'){ setState(() { url = res['fileId']; }); }else{ Fluttertoast.showToast( msg: res['codeDesc'], backgroundColor: Color(GSYColors.toastBg), textColor: Color(GSYColors.titleBlack)); return; } }).catchError((e){ print(e.toString()); }); setState(() { if (image != null) _image = image; }); }

 

 

上一篇:setState各在什么时候执行同步/异步


下一篇:react-native如何看待 this.setState()