MCPcopy Create free account
hub / github.com/auth0/auth0-cli / pubspecHasFlutterWebTarget

Function pubspecHasFlutterWebTarget

internal/cli/quickstart_detect.go:366–384  ·  view source on GitHub ↗

pubspecHasFlutterWebTarget returns true if "web:" is nested under "flutter:" in pubspec.yaml.

(data string)

Source from the content-addressed store, hash-verified

364
365// pubspecHasFlutterWebTarget returns true if "web:" is nested under "flutter:" in pubspec.yaml.
366func pubspecHasFlutterWebTarget(data string) bool {
367 inFlutterSection := false
368 for _, line := range strings.Split(data, "\n") {
369 trimmed := strings.TrimSpace(line)
370 if trimmed == "" || strings.HasPrefix(trimmed, "#") {
371 continue
372 }
373 // A line with no leading whitespace is a top-level YAML key.
374 isTopLevel := len(line) > 0 && line[0] != ' ' && line[0] != '\t'
375 if isTopLevel {
376 inFlutterSection = strings.HasPrefix(line, "flutter:")
377 continue
378 }
379 if inFlutterSection && strings.HasPrefix(trimmed, "web:") {
380 return true
381 }
382 }
383 return false
384}
385
386func dirExists(dir, name string) bool {
387 info, err := os.Stat(filepath.Join(dir, name))

Callers 1

DetectProjectFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected