Skip to content

[flutter_tools] flutter pub get <target_directory> not working as intended #104760

@Jasguerrero

Description

@Jasguerrero

Currently the invocation of flutter pub get accepts a target directory

@override
String get invocation {
return '${runner!.executableName} pub $name [<target directory>]';
}

But in the constructor it requires the command to have a pubspec.yml in the same directory it ran

If not pubspec.yml was found in the current directory (even though there is a valid pubspec in the target) the command fails here
throw ToolExit(userMessages.flutterNoPubspec);

Proposed fixed is to delete the required requiresPubspecYaml function from the command constructor and have a helper function on the runCommand method to check for the pubspec on the target directory if one is provided or in the current working directory and its parent folders if not

Metadata

Metadata

Assignees

No one assigned

    Labels

    toolAffects the "flutter" command-line tool. See also t: labels.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions