putFile method

  1. @override
Future<String> putFile(
  1. String targetPath,
  2. String localPath
)
override

Stores a file from the localPath at the specified targetPath.

This is more memory-efficient than put for large files.

Implementation

@override
Future<String> putFile(String targetPath, String localPath) async {
  final fullPath = p.join(root, targetPath);
  final targetFile = File(fullPath);
  if (!await targetFile.parent.exists()) {
    await targetFile.parent.create(recursive: true);
  }

  // Copy the file to the storage location
  await File(localPath).copy(fullPath);
  return targetPath;
}