upLoadHeadImage static method
上传头像
Implementation
static Future<DataResult> upLoadHeadImage(String? headImage) async {
String? image = await BaseDao.compressImage(headImage!);
var name = image.substring(image.lastIndexOf('/') + 1, image.length);
FormData formData = FormData.fromMap(
{'file': MultipartFile.fromFileSync(image, filename: name)});
var res = await BaseDao.fromBaseJson(formData, Address.upLoadHeadImage());
if (res.result) {
var entity = TokenEntity.fromJson(res.data);
return DataResult(entity, true);
}
return res;
}