mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
flutter_tool: DRY up arg helpers, use new typed arg functions (#151784)
This commit is contained in:
parent
91a5b7bd9a
commit
83bfab5376
@ -1884,10 +1884,7 @@ Run 'flutter -h' (or 'flutter <command> -h') for available flutter commands and
|
||||
/// If no flag named [name] was added to the [ArgParser], an [ArgumentError]
|
||||
/// will be thrown.
|
||||
bool boolArg(String name, {bool global = false}) {
|
||||
if (global) {
|
||||
return globalResults![name] as bool;
|
||||
}
|
||||
return argResults![name] as bool;
|
||||
return (global ? globalResults : argResults)!.flag(name);
|
||||
}
|
||||
|
||||
/// Gets the parsed command-line option named [name] as a `String`.
|
||||
@ -1895,18 +1892,12 @@ Run 'flutter -h' (or 'flutter <command> -h') for available flutter commands and
|
||||
/// If no option named [name] was added to the [ArgParser], an [ArgumentError]
|
||||
/// will be thrown.
|
||||
String? stringArg(String name, {bool global = false}) {
|
||||
if (global) {
|
||||
return globalResults![name] as String?;
|
||||
}
|
||||
return argResults![name] as String?;
|
||||
return (global ? globalResults : argResults)!.option(name);
|
||||
}
|
||||
|
||||
/// Gets the parsed command-line option named [name] as `List<String>`.
|
||||
List<String> stringsArg(String name, {bool global = false}) {
|
||||
if (global) {
|
||||
return globalResults![name] as List<String>;
|
||||
}
|
||||
return argResults![name] as List<String>;
|
||||
return (global ? globalResults : argResults)!.multiOption(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user