loadDeclaredProfile static method

ProjectOperationProfile? loadDeclaredProfile(
  1. Directory workspace
)

Reads the declared profile of workspace.

Returns null when the project declared nothing. Throws ProjectOperationProfileFormatException when the declaration is refused. Reading a declaration starts no process and probes no endpoint.

Implementation

static ProjectOperationProfile? loadDeclaredProfile(Directory workspace) {
  final file = declarationFile(workspace);
  if (file == null) return null;
  if (file.lengthSync() > maxDeclarationBytes) {
    throw const ProjectOperationProfileFormatException(
      'project_operation_profile_too_large',
      'the declaration is larger than the accepted bound',
    );
  }
  return decode(file.readAsStringSync());
}