upload method
Future<Uri>
upload(
- String name, {
- Uri? imagePath,
- Uint8List? bytes,
- required ImageFormat format,
Upload an image to the Subreddit.
name
is the name to be used for the image. If an image already exists
with this name, it will be replaced.
imagePath
is the path to a JPEG or PNG image. This path must be local
and accessible from disk. Will result in an UnsupportedError if provided
in a web application.
bytes
is a list of bytes representing an image.
format
is the format of the image defined by bytes
.
On success, the Uri
for the uploaded image is returned. On failure,
DRAWImageUploadException is thrown.
Implementation
Future<Uri> upload(String name,
{Uri? imagePath,
Uint8List? bytes,
required ImageFormat format}) async =>
await _uploadImage(imagePath, bytes, format, <String, String>{
'name': name,
_kUploadType: 'img',
});