projectDependencyIssues method

List<String> projectDependencyIssues({
  1. required SupportedDartSdkPolicy? supportedSdkPolicy,
  2. bool requireServerpod = true,
})

Validates the pubspec.yaml dependencies of a customer project in order to be deployed to Serverpod Cloud.

supportedSdkPolicy is the Dart SDK version policy of Serverpod Cloud, fetched from the server. If it is null the SDK version range check is skipped - the server enforces the policy when the deployment is created. The check that the pubspec declares a sdk constraint at all always runs, since it needs no server data.

If the dependencies are not valid, the returned list will contain the error messages. If the dependencies are valid, the list will be empty.

Implementation

List<String> projectDependencyIssues({
  required final SupportedDartSdkPolicy? supportedSdkPolicy,
  final bool requireServerpod = true,
}) {
  final supportedServerpod = VersionConstraint.parse(
    VersionConstants.supportedServerpodConstraint,
  );

  final sdkError = _validateEnvironmentConstraints(supportedSdkPolicy);

  final serverpodError = _validateHostedDependencyConstraint(
    packageName: 'serverpod',
    supported: supportedServerpod,
    requireDependency: requireServerpod,
  );

  return [
    if (sdkError != null) sdkError,
    if (serverpodError != null) serverpodError,
  ];
}