// Set the public request headers
client.setHeaders({'accept-charset': 'utf-8'});
// Set the connection server timeout time in milliseconds.
client.setConnectTimeout(8000);
// Set send data timeout time in milliseconds.
client.setSendTimeout(8000);
// Set transfer data time in milliseconds.
client.setReceiveTimeout(8000);
// Test whether the service can connecttry {
await client.ping();
} catch (e) {
print('$e');
}
Read all files in a folder
var list = await client.readDir('/');
list.forEach((f) {
print('${f.name}${f.path}');
});
// can sub foldervar list2 = await client.readDir('/sub/sub/folder');
list2.forEach((f) {
print('${f.name}${f.path}');
});
If copied the folder (A > B), it will copy all the contents of folder A to folder B.
Some webdav services have been tested and found to delete the original contents of the B folder!!!
// Copy all the contents of folderA to folder Bawait client.copy('/folder/folderA/', '/folder/folderB/', true);
// Copy fileawait client.copy('/folder/aa.png', '/folder/bb.png', true);