putToBlobStorage static method
Implementation
static Future<bool> putToBlobStorage(String imageWithoutContainerName, String sasSuffix, Uint8List postData) async {
try {
String url = blobCDNUrl + imageWithoutContainerName + sasSuffix;
await Dioo.put(url,
data: Stream.fromIterable(
postData.map((e) => [e]),
),
options: Options(
headers: {
HttpHeaders.contentLengthHeader: postData.length,
"x-ms-blob-type": "BlockBlob",
},
),
trackTelemetry: false);
logger.d('Posted image successfully imageName: $imageWithoutContainerName');
return true;
} on DioError catch (e) {
if (e.response?.statusCode == 403) {
// Utils.inform(context, 'No permission to post image');
} else {
// Utils.inform(context, 'Error happened while uploading image');
}
logger.d('Upload of blob failed${e.response}');
return false;
}
}