Name:
interface
Value:
Amplify has re-imagined the way frontend developers build fullstack applications. Develop and deploy without the hassle.

Page updated May 21, 2024

Copy files

Amplify Flutter v1 is deprecated as of April 30th, 2025. No new features or bug fixes will be added. Dependencies may become outdated and potentially introduce compatibility issues.

Please use the latest version (v2) of Amplify Flutter to get started.

If you are currently using v1, follow these instructions to upgrade to v2.

You can copy an existing file to a different location in your S3 bucket. User who initiates a copy operation should have read permission on the copy source file.

import 'package:amplify_flutter/amplify_flutter.dart';
Future<void> copy({
required String sourceKey,
required String destinationKey,
}) async {
try {
final result = await Amplify.Storage.copy(
source: StorageItemWithAccessLevel(
storageItem: StorageItem(key: sourceKey),
accessLevel: StorageAccessLevel.guest,
),
destination: StorageItemWithAccessLevel(
storageItem: StorageItem(key: destinationKey),
accessLevel: StorageAccessLevel.private,
),
).result;
safePrint('Copied file: ${result.copiedItem.key}');
} on StorageException catch (e) {
safePrint('Error copying file: ${e.message}');
rethrow;
}
}