rename method

Future<void> rename(
  1. String newName
)

Rename this collection.

Implementation

Future<void> rename(String newName) async {
  // PUT the new name of this collection to the CARP web service
  final response = await service._put(
    collectionUriByID,
    body: '{"name":"$newName"}',
  );

  // we don't need the response for anything, but check for errors
  service._handleResponse(response);

  // renaming path, i.e. the last part of the path
  int start = _path.length - _path.split('/').last.length;
  _path = _path.replaceRange(start, _path.length, newName);
}