moveToSdkVersionDiretory method

void moveToSdkVersionDiretory(
  1. CacheFlutterVersion version
)

Moves a CacheFlutterVersion to the cache of sdkVersion

Implementation

void moveToSdkVersionDiretory(CacheFlutterVersion version) {
  final sdkVersion = version.flutterSdkVersion;

  if (sdkVersion == null) {
    throw AppException(
      'Cannot move to SDK version directory without a valid version',
    );
  }
  final versionDir = Directory(version.directory);
  final newDir = getVersionCacheDir(sdkVersion);

  if (newDir.existsSync()) {
    newDir.deleteSync(recursive: true);
  }

  if (versionDir.existsSync()) {
    versionDir.renameSync(newDir.path);
  }
}