Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

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 now in Maintenance Mode until April 30th, 2025. This means that we will continue to include updates to ensure compatibility with backend services and security. No new features will be introduced in v1.

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;
}
}