move method

Future<String> move(
  1. String fromPath,
  2. String toPath
)

Moves an existing file.

fromPath is the original file path, including the current file name. For example folder/image.png. toPath is the new file path, including the new file name. For example folder/image-new.png.

Implementation

Future<String> move(String fromPath, String toPath) async {
  final options = FetchOptions(headers: headers);
  final response = await _storageFetch.post(
    '$url/object/move',
    {
      'bucketId': bucketId,
      'sourceKey': fromPath,
      'destinationKey': toPath,
    },
    options: options,
  );
  return (response as Map<String, dynamic>)['message'] as String;
}