import flutter0 from "/src/fragments/lib-v1/storage/flutter/path-provider.mdx"; ```dart import 'dart:io'; import 'package:path_provider/path_provider.dart'; Future createAndUploadFile() async { // Create a dummy file const exampleString = 'Example file contents'; final tempDir = await getTemporaryDirectory(); final exampleFile = File('${tempDir.path}/example.txt'); await exampleFile.create(); await exampleFile.writeAsString(exampleString); // Upload the file to S3 try { final result = await Amplify.Storage.uploadFile( local: exampleFile, key: 'ExampleKey', onProgress: (progress) { safePrint('Fraction completed: ${progress.getFractionCompleted()}'); }, ); safePrint('Successfully uploaded file: ${result.key}'); } on StorageException catch (e) { safePrint('Error uploading file: $e'); } finally { await exampleFile.delete(); } } ```