Skip to content

Improve the check for whether a project is Flutter to be more reliable #4702

Closed
@DanTup

Description

@DanTup

This code does a basic regex to check for sdk: flutter in the pubspec.yaml to decide whether a project is a Flutter project or not:

export function pubspecContentReferencesFlutterSdk(content: string): boolean {
const regex = new RegExp("sdk\\s*:\\s*[\"']?flutter[\"']?", "i");
return regex.test(content);
}

It was done this way for simplicity when we had no yaml parser referenced. It can be tripped up by comments and other unrelated keys. Now we have a yaml parser, we should do this properly so it's reliable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions