# uploadImage method Null safety

Future<ImageUploadResult> uploadImage(

1. File image,
2. {bool secureResource = true}

)

로컬 이미지를 카카오톡 공유 컨텐츠 이미지로 활용하기 위해 카카오 이미지 서버로 업로드

## Implementation

    Future<ImageUploadResult> uploadImage(File image,
        {bool secureResource = true}) {
      return ApiFactory.handleApiError(() async {
        var formData = FormData();
        var file = await MultipartFile.fromFile(image.path,
            filename: image.path.split("/").last);
        formData.files.add(MapEntry(Constants.file, file));
        formData.fields
            .add(MapEntry(Constants.secureResource, secureResource.toString()));
        Response response =
            await dio.post(Constants.uploadImagePath, data: formData);
        return ImageUploadResult.fromJson(response.data);
      });
    }