Page updated Jan 16, 2024

Get file properties

You can get file properties and metadata without downloading the file using Amplify.Storage.getProperties.

1import 'package:amplify_flutter/amplify_flutter.dart';
2
3Future<void> getFileProperties() async {
4 try {
5 final result = await Amplify.Storage.getProperties(
6 key: 'example.txt',
7 ).result;
8
9 safePrint('File size: ${result.storageItem.size}');
10 } on StorageException catch (e) {
11 safePrint('Could not retrieve properties: ${e.message}');
12 rethrow;
13 }
14}