upLoadHeadImage static method

Future<DataResult> upLoadHeadImage(
  1. String? headImage
)

上传头像

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;
}