getSpace method

Future<Space> getSpace(
  1. String relativePath
)

Gets a space by path relative to this project.

If relativePath begins with / it is treated as an absolute path and used as-is; otherwise it is resolved relative to this project's root.

final chars = await project.getSpace('characters');
final heroes = await project.getSpace('characters/heroes');
final absolute = await project.getSpace('/film-2024/characters');

Implementation

Future<Space> getSpace(String relativePath) async {
  final fullPath =
      relativePath.startsWith('/') ? relativePath : '/$name/$relativePath';
  final response = await client.getSpace(fullPath);
  return Space(response, client);
}