MCPcopy Create free account
hub / github.com/Dart-Code/Dart-Code / promptForFlutterClone

Method promptForFlutterClone

src/extension/sdk/utils.ts:242–268  ·  view source on GitHub ↗
(gitExecutable: string)

Source from the content-addressed store, hash-verified

240 }
241
242 private async promptForFlutterClone(gitExecutable: string): Promise<{ folder?: string, result: CloneSdkResult }> {
243 const selectedFolders =
244 await window.showOpenDialog({
245 defaultUri: Uri.file(os.homedir()),
246 canSelectFiles: false,
247 canSelectFolders: true,
248 canSelectMany: false,
249 openLabel: `Clone Flutter`,
250 title: "Select Folder for Flutter SDK",
251 });
252 if (selectedFolders?.length === 1) {
253 const workingDirectory = fsPath(selectedFolders[0]);
254 const cloneResult = await this.cloneFlutterWithProgress(gitExecutable, workingDirectory);
255 const didClone = cloneResult === GitOperationResult.success;
256
257 const result = cloneResult === GitOperationResult.success
258 ? CloneSdkResult.succeeded
259 : cloneResult === GitOperationResult.cancelled
260 ? CloneSdkResult.cancelled
261 : CloneSdkResult.failed;
262 this.analytics.logGitCloneSdk(result);
263
264 return { result, folder: didClone ? path.join(workingDirectory, "flutter") : undefined };
265 }
266
267 return { result: CloneSdkResult.cancelled };
268 }
269
270 private async cloneFlutterWithProgress(gitExecutable: string, workingDirectory: string): Promise<GitOperationResult> {
271 const gitUrl = "https://github.com/flutter/flutter.git";

Callers 1

Calls 3

fsPathFunction · 0.90
logGitCloneSdkMethod · 0.80

Tested by

no test coverage detected