1 | initial version |
The process of uploading files to OSS cloud service using Flutter consists of the following steps:
final OSS client = OSS(
endpoint: 'your_endpoint',
credentials: Credential(
accessKey: 'your_accessKey',
secretKey: 'your_secretKey',
),
);
final ref = client.ref(bucketName, objectKey);
await ref.putObject(
filePath,
options: PutObjectOptions(headers: {key: value}),
);
await ref.putObject(
filePath,
options: PutObjectOptions(),
onProgress: (int progress, int uploadedBytes, int totalBytes) {
// Handle progress updates
},
);
final result = await ref.putObject(filePath);
await ref.putObject(filePath).catchError((error) {
// Handle error
});