shareFiles method
Implementation
Future<Map<String, FileTransferObject>> shareFiles(
List<String> sharedWithAtSigns,
String key,
String fileUrl,
String encryptionKey,
List<FileStatus> fileStatus,
{DateTime? date}) async {
var result = <String, FileTransferObject>{};
for (var sharedWithAtSign in sharedWithAtSigns) {
var fileTransferObject = FileTransferObject(
key, encryptionKey, fileUrl, sharedWithAtSign, fileStatus,
date: date);
try {
var atKey = AtKey()
..key = key
..sharedWith = sharedWithAtSign
..metadata = Metadata()
..metadata!.ttr = -1
..sharedBy = currentAtSign;
fileTransferObject.sharedStatus =
await put(atKey, jsonEncode(fileTransferObject.toJson()));
} on Exception catch (e) {
fileTransferObject.sharedStatus = false;
fileTransferObject.error = e.toString();
}
result[sharedWithAtSign] = fileTransferObject;
}
return result;
}