Get file properties
These docs cover Amplify Gen 1. For new web apps, we recommend the latest AWS Amplify, with a simplified CLI and native integrations for databases, storage, and AI models. Get started with the latest AWS Amplify.
You can get file properties and metadata without downloading the file using Amplify.Storage.getProperties.
import 'package:amplify_flutter/amplify_flutter.dart';
Future<void> getFileProperties() async { try { final result = await Amplify.Storage.getProperties( key: 'example.txt', ).result;
safePrint('File size: ${result.storageItem.size}'); } on StorageException catch (e) { safePrint('Could not retrieve properties: ${e.message}'); rethrow; }}