validate method

void validate()

Validates this workspace against the environment.

By making this a separate method we can create workspaces for testing which are not strictly valid.

Implementation

void validate() {
  if (sdkPath != null) {
    final dartTool = sdkTool('dart');
    if (!fileExists(dartTool)) {
      throw MelosConfigException(
        'SDK path is not valid. Could not find dart tool at $dartTool',
      );
    }
    if (isFlutterWorkspace) {
      final flutterTool = sdkTool('flutter');
      if (!fileExists(flutterTool)) {
        throw MelosConfigException(
          'SDK path is not valid. Could not find flutter tool at $dartTool',
        );
      }
    }
  }
}