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

Function projectReferencesFlutter

src/shared/utils/fs.ts:223–235  ·  view source on GitHub ↗
(folder?: string)

Source from the content-addressed store, hash-verified

221}
222
223export function projectReferencesFlutter(folder?: string): boolean {
224 if (folder && hasPubspec(folder)) {
225 const pubspecPath = path.join(folder, "pubspec.yaml");
226 try {
227 const pubspecContent = fs.readFileSync(pubspecPath);
228 return pubspecContentReferencesFlutter(pubspecContent.toString());
229 } catch (e: any) {
230 if (e?.code !== "ENOENT") // Don't warn for missing files.
231 console.warn(`Failed to read ${pubspecPath}: ${e}`);
232 }
233 }
234 return false;
235}
236
237export function pubspecContentReferencesFlutter(content: string): boolean {
238 // Do a fast string check first, because YAML parse can be slow in comparison.

Callers 3

handlePubspecChangeMethod · 0.90
scanWorkspaceMethod · 0.90
isFlutterProjectFolderFunction · 0.85

Calls 4

hasPubspecFunction · 0.85
warnMethod · 0.65
toStringMethod · 0.45

Tested by

no test coverage detected