Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
596e9d1c
Unverified
Commit
596e9d1c
authored
May 09, 2022
by
Jesús S Guerrero
Committed by
GitHub
May 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] stringArg refactor (#103231)
parent
95116386
Changes
29
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
195 additions
and
160 deletions
+195
-160
assemble.dart
packages/flutter_tools/lib/src/commands/assemble.dart
+5
-5
attach.dart
packages/flutter_tools/lib/src/commands/attach.dart
+10
-10
build_aar.dart
packages/flutter_tools/lib/src/commands/build_aar.dart
+2
-2
build_bundle.dart
packages/flutter_tools/lib/src/commands/build_bundle.dart
+4
-4
build_fuchsia.dart
packages/flutter_tools/lib/src/commands/build_fuchsia.dart
+2
-2
build_ios.dart
packages/flutter_tools/lib/src/commands/build_ios.dart
+3
-3
build_ios_framework.dart
...s/flutter_tools/lib/src/commands/build_ios_framework.dart
+1
-1
build_linux.dart
packages/flutter_tools/lib/src/commands/build_linux.dart
+2
-2
build_web.dart
packages/flutter_tools/lib/src/commands/build_web.dart
+4
-4
config.dart
packages/flutter_tools/lib/src/commands/config.dart
+3
-3
create.dart
packages/flutter_tools/lib/src/commands/create.dart
+14
-14
create_base.dart
packages/flutter_tools/lib/src/commands/create_base.dart
+3
-3
custom_devices.dart
packages/flutter_tools/lib/src/commands/custom_devices.dart
+2
-2
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+1
-1
devices.dart
packages/flutter_tools/lib/src/commands/devices.dart
+1
-1
doctor.dart
packages/flutter_tools/lib/src/commands/doctor.dart
+1
-1
downgrade.dart
packages/flutter_tools/lib/src/commands/downgrade.dart
+1
-1
drive.dart
packages/flutter_tools/lib/src/commands/drive.dart
+15
-15
emulators.dart
packages/flutter_tools/lib/src/commands/emulators.dart
+2
-2
generate_localizations.dart
...lutter_tools/lib/src/commands/generate_localizations.dart
+10
-10
install.dart
packages/flutter_tools/lib/src/commands/install.dart
+2
-2
run.dart
packages/flutter_tools/lib/src/commands/run.dart
+24
-24
screenshot.dart
packages/flutter_tools/lib/src/commands/screenshot.dart
+5
-5
symbolize.dart
packages/flutter_tools/lib/src/commands/symbolize.dart
+7
-7
test.dart
packages/flutter_tools/lib/src/commands/test.dart
+12
-12
update_packages.dart
packages/flutter_tools/lib/src/commands/update_packages.dart
+2
-2
upgrade.dart
packages/flutter_tools/lib/src/commands/upgrade.dart
+3
-3
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+26
-19
args_test.dart
packages/flutter_tools/test/general.shard/args_test.dart
+28
-0
No files found.
packages/flutter_tools/lib/src/commands/assemble.dart
View file @
596e9d1c
...
...
@@ -215,7 +215,7 @@ class AssembleCommand extends FlutterCommand {
/// The environmental configuration for a build invocation.
Environment
createEnvironment
()
{
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
String
?
output
=
stringArg
(
'output'
);
String
?
output
=
stringArg
Deprecated
(
'output'
);
if
(
output
==
null
)
{
throwToolExit
(
'--output directory is required for assemble.'
);
}
...
...
@@ -318,7 +318,7 @@ class AssembleCommand extends FlutterCommand {
environment
,
buildSystemConfig:
BuildSystemConfig
(
resourcePoolSize:
argumentResults
.
wasParsed
(
'resource-pool-size'
)
?
int
.
tryParse
(
stringArg
(
'resource-pool-size'
)!)
?
int
.
tryParse
(
stringArg
Deprecated
(
'resource-pool-size'
)!)
:
null
,
),
);
...
...
@@ -335,17 +335,17 @@ class AssembleCommand extends FlutterCommand {
globals
.
printTrace
(
'build succeeded.'
);
if
(
argumentResults
.
wasParsed
(
'build-inputs'
))
{
writeListIfChanged
(
result
.
inputFiles
,
stringArg
(
'build-inputs'
)!);
writeListIfChanged
(
result
.
inputFiles
,
stringArg
Deprecated
(
'build-inputs'
)!);
}
if
(
argumentResults
.
wasParsed
(
'build-outputs'
))
{
writeListIfChanged
(
result
.
outputFiles
,
stringArg
(
'build-outputs'
)!);
writeListIfChanged
(
result
.
outputFiles
,
stringArg
Deprecated
(
'build-outputs'
)!);
}
if
(
argumentResults
.
wasParsed
(
'performance-measurement-file'
))
{
final
File
outFile
=
globals
.
fs
.
file
(
argumentResults
[
'performance-measurement-file'
]);
writePerformanceData
(
result
.
performance
.
values
,
outFile
);
}
if
(
argumentResults
.
wasParsed
(
'depfile'
))
{
final
File
depfileFile
=
globals
.
fs
.
file
(
stringArg
(
'depfile'
));
final
File
depfileFile
=
globals
.
fs
.
file
(
stringArg
Deprecated
(
'depfile'
));
final
Depfile
depfile
=
Depfile
(
result
.
inputFiles
,
result
.
outputFiles
);
final
DepfileService
depfileService
=
DepfileService
(
fileSystem:
globals
.
fs
,
...
...
packages/flutter_tools/lib/src/commands/attach.dart
View file @
596e9d1c
...
...
@@ -153,7 +153,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
return
null
;
}
try
{
return
int
.
parse
(
stringArg
(
'debug-port'
));
return
int
.
parse
(
stringArg
Deprecated
(
'debug-port'
));
}
on
Exception
catch
(
error
)
{
throwToolExit
(
'Invalid port for `--debug-port`:
$error
'
);
}
...
...
@@ -163,9 +163,9 @@ known, it can be explicitly provided to attach via the command-line, e.g.
if
(
argResults
[
'debug-url'
]
==
null
)
{
return
null
;
}
final
Uri
uri
=
Uri
.
tryParse
(
stringArg
(
'debug-url'
));
final
Uri
uri
=
Uri
.
tryParse
(
stringArg
Deprecated
(
'debug-url'
));
if
(
uri
==
null
)
{
throwToolExit
(
'Invalid `--debug-url`:
${stringArg('debug-url')}
'
);
throwToolExit
(
'Invalid `--debug-url`:
${stringArg
Deprecated
('debug-url')}
'
);
}
if
(!
uri
.
hasPort
)
{
throwToolExit
(
'Port not specified for `--debug-url`:
$uri
'
);
...
...
@@ -174,10 +174,10 @@ known, it can be explicitly provided to attach via the command-line, e.g.
}
String
get
appId
{
return
stringArg
(
'app-id'
);
return
stringArg
Deprecated
(
'app-id'
);
}
String
get
userIdentifier
=>
stringArg
(
FlutterOptions
.
kDeviceUser
);
String
get
userIdentifier
=>
stringArg
Deprecated
(
FlutterOptions
.
kDeviceUser
);
@override
Future
<
void
>
validateCommand
()
async
{
...
...
@@ -255,7 +255,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
if
(
debugPort
==
null
&&
debugUri
==
null
)
{
if
(
device
is
FuchsiaDevice
)
{
final
String
module
=
stringArg
(
'module'
);
final
String
module
=
stringArg
Deprecated
(
'module'
);
if
(
module
==
null
)
{
throwToolExit
(
"'--module' is required for attaching to a Fuchsia device"
);
}
...
...
@@ -370,7 +370,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
signals:
globals
.
signals
,
processInfo:
globals
.
processInfo
,
reportReady:
boolArg
(
'report-ready'
),
pidFile:
stringArg
(
'pid-file'
),
pidFile:
stringArg
Deprecated
(
'pid-file'
),
)
..
registerSignalHandlers
()
..
setupTerminal
();
...
...
@@ -418,7 +418,7 @@ known, it can be explicitly provided to attach via the command-line, e.g.
final
FlutterDevice
flutterDevice
=
await
FlutterDevice
.
create
(
device
,
target:
targetFile
,
targetModel:
TargetModel
(
stringArg
(
'target-model'
)),
targetModel:
TargetModel
(
stringArg
Deprecated
(
'target-model'
)),
buildInfo:
buildInfo
,
userIdentifier:
userIdentifier
,
platform:
globals
.
platform
,
...
...
@@ -437,8 +437,8 @@ known, it can be explicitly provided to attach via the command-line, e.g.
target:
targetFile
,
debuggingOptions:
debuggingOptions
,
packagesFilePath:
globalResults
[
'packages'
]
as
String
,
projectRootPath:
stringArg
(
'project-root'
),
dillOutputPath:
stringArg
(
'output-dill'
),
projectRootPath:
stringArg
Deprecated
(
'project-root'
),
dillOutputPath:
stringArg
Deprecated
(
'output-dill'
),
ipv6:
usesIpv6
,
flutterProject:
flutterProject
,
)
...
...
packages/flutter_tools/lib/src/commands/build_aar.dart
View file @
596e9d1c
...
...
@@ -112,7 +112,7 @@ class BuildAarCommand extends BuildSubCommand {
final
Iterable
<
AndroidArch
>
targetArchitectures
=
stringsArg
(
'target-platform'
).
map
<
AndroidArch
>(
getAndroidArchForName
);
final
String
?
buildNumberArg
=
stringArg
(
'build-number'
);
final
String
?
buildNumberArg
=
stringArg
Deprecated
(
'build-number'
);
final
String
buildNumber
=
argParser
.
options
.
containsKey
(
'build-number'
)
&&
buildNumberArg
!=
null
&&
buildNumberArg
.
isNotEmpty
...
...
@@ -142,7 +142,7 @@ class BuildAarCommand extends BuildSubCommand {
project:
_getProject
(),
target:
targetFile
.
path
,
androidBuildInfo:
androidBuildInfo
,
outputDirectoryPath:
stringArg
(
'output-dir'
),
outputDirectoryPath:
stringArg
Deprecated
(
'output-dir'
),
buildNumber:
buildNumber
,
);
return
FlutterCommandResult
.
success
();
...
...
packages/flutter_tools/lib/src/commands/build_bundle.dart
View file @
596e9d1c
...
...
@@ -80,7 +80,7 @@ class BuildBundleCommand extends BuildSubCommand {
return
const
CustomDimensions
();
}
return
CustomDimensions
(
commandBuildBundleTargetPlatform:
stringArg
(
'target-platform'
),
commandBuildBundleTargetPlatform:
stringArg
Deprecated
(
'target-platform'
),
commandBuildBundleIsModule:
flutterProject
.
isModule
,
);
}
...
...
@@ -95,7 +95,7 @@ class BuildBundleCommand extends BuildSubCommand {
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
final
String
targetPlatform
=
stringArg
(
'target-platform'
)!;
final
String
targetPlatform
=
stringArg
Deprecated
(
'target-platform'
)!;
final
TargetPlatform
platform
=
getTargetPlatformForName
(
targetPlatform
);
if
(
platform
==
null
)
{
throwToolExit
(
'Unknown platform:
$targetPlatform
'
);
...
...
@@ -138,8 +138,8 @@ class BuildBundleCommand extends BuildSubCommand {
platform:
platform
,
buildInfo:
buildInfo
,
mainPath:
targetFile
,
depfilePath:
stringArg
(
'depfile'
),
assetDirPath:
stringArg
(
'asset-dir'
),
depfilePath:
stringArg
Deprecated
(
'depfile'
),
assetDirPath:
stringArg
Deprecated
(
'asset-dir'
),
);
return
FlutterCommandResult
.
success
();
}
...
...
packages/flutter_tools/lib/src/commands/build_fuchsia.dart
View file @
596e9d1c
...
...
@@ -79,9 +79,9 @@ class BuildFuchsiaCommand extends BuildSubCommand {
await
buildFuchsia
(
fuchsiaProject:
flutterProject
.
fuchsia
,
target:
targetFile
,
targetPlatform:
getTargetPlatformForName
(
stringArg
(
'target-platform'
)!),
targetPlatform:
getTargetPlatformForName
(
stringArg
Deprecated
(
'target-platform'
)!),
buildInfo:
buildInfo
,
runnerPackageSource:
stringArg
(
'runner-source'
)!,
runnerPackageSource:
stringArg
Deprecated
(
'runner-source'
)!,
);
return
FlutterCommandResult
.
success
();
}
...
...
packages/flutter_tools/lib/src/commands/build_ios.dart
View file @
596e9d1c
...
...
@@ -98,7 +98,7 @@ class BuildIOSArchiveCommand extends _BuildIOSSubCommand {
@override
final
bool
configOnly
=
false
;
String
?
get
exportOptionsPlist
=>
stringArg
(
'export-options-plist'
);
String
?
get
exportOptionsPlist
=>
stringArg
Deprecated
(
'export-options-plist'
);
@override
Directory
_outputAppDirectory
(
String
xcodeResultOutput
)
=>
globals
.
fs
...
...
@@ -153,7 +153,7 @@ class BuildIOSArchiveCommand extends _BuildIOSSubCommand {
final
String
relativeOutputPath
=
app
.
ipaOutputPath
;
final
String
absoluteOutputPath
=
globals
.
fs
.
path
.
absolute
(
relativeOutputPath
);
final
String
absoluteArchivePath
=
globals
.
fs
.
path
.
absolute
(
app
.
archiveBundleOutputPath
);
final
String
exportMethod
=
stringArg
(
'export-method'
)!;
final
String
exportMethod
=
stringArg
Deprecated
(
'export-method'
)!;
final
bool
isAppStoreUpload
=
exportMethod
==
'app-store'
;
File
?
generatedExportPlist
;
try
{
...
...
@@ -241,7 +241,7 @@ class BuildIOSArchiveCommand extends _BuildIOSSubCommand {
'''
);
plistContents
.
write
(
'''
<string>
${stringArg('export-method')}
</string>
<string>
${stringArg
Deprecated
('export-method')}
</string>
'''
);
if
(
xcodeBuildResult
?.
xcodeBuildExecution
?.
buildSettings
[
'ENABLE_BITCODE'
]
!=
'YES'
)
{
// Bitcode is off by default in Flutter iOS apps.
...
...
packages/flutter_tools/lib/src/commands/build_ios_framework.dart
View file @
596e9d1c
...
...
@@ -159,7 +159,7 @@ class BuildIOSFrameworkCommand extends BuildSubCommand {
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
final
String
outputArgument
=
stringArg
(
'output'
)
final
String
outputArgument
=
stringArg
Deprecated
(
'output'
)
??
globals
.
fs
.
path
.
join
(
globals
.
fs
.
currentDirectory
.
path
,
'build'
,
'ios'
,
'framework'
);
if
(
outputArgument
.
isEmpty
)
{
...
...
packages/flutter_tools/lib/src/commands/build_linux.dart
View file @
596e9d1c
...
...
@@ -61,7 +61,7 @@ class BuildLinuxCommand extends BuildSubCommand {
final
BuildInfo
buildInfo
=
await
getBuildInfo
();
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
TargetPlatform
targetPlatform
=
getTargetPlatformForName
(
stringArg
(
'target-platform'
)!);
getTargetPlatformForName
(
stringArg
Deprecated
(
'target-platform'
)!);
final
bool
needCrossBuild
=
getNameForHostPlatformArch
(
_operatingSystemUtils
.
hostPlatform
)
!=
getNameForTargetPlatformArch
(
targetPlatform
);
...
...
@@ -95,7 +95,7 @@ class BuildLinuxCommand extends BuildSubCommand {
),
needCrossBuild:
needCrossBuild
,
targetPlatform:
targetPlatform
,
targetSysroot:
stringArg
(
'target-sysroot'
)!,
targetSysroot:
stringArg
Deprecated
(
'target-sysroot'
)!,
);
return
FlutterCommandResult
.
success
();
}
...
...
packages/flutter_tools/lib/src/commands/build_web.dart
View file @
596e9d1c
...
...
@@ -90,12 +90,12 @@ class BuildWebCommand extends BuildSubCommand {
throwToolExit
(
'"build web" is not currently supported. To enable, run "flutter config --enable-web".'
);
}
final
FlutterProject
flutterProject
=
FlutterProject
.
current
();
final
String
target
=
stringArg
(
'target'
)!;
final
String
target
=
stringArg
Deprecated
(
'target'
)!;
final
BuildInfo
buildInfo
=
await
getBuildInfo
();
if
(
buildInfo
.
isDebug
)
{
throwToolExit
(
'debug builds cannot be built directly for the web. Try using "flutter run"'
);
}
final
String
?
baseHref
=
stringArg
(
'base-href'
);
final
String
?
baseHref
=
stringArg
Deprecated
(
'base-href'
);
if
(
baseHref
!=
null
&&
!(
baseHref
.
startsWith
(
'/'
)
&&
baseHref
.
endsWith
(
'/'
)))
{
throwToolExit
(
'base-href should start and end with /'
);
}
...
...
@@ -119,11 +119,11 @@ class BuildWebCommand extends BuildSubCommand {
target
,
buildInfo
,
boolArg
(
'csp'
),
stringArg
(
'pwa-strategy'
)!,
stringArg
Deprecated
(
'pwa-strategy'
)!,
boolArg
(
'source-maps'
),
boolArg
(
'native-null-assertions'
),
baseHref
,
stringArg
(
'dart2js-optimization'
),
stringArg
Deprecated
(
'dart2js-optimization'
),
);
return
FlutterCommandResult
.
success
();
}
...
...
packages/flutter_tools/lib/src/commands/config.dart
View file @
596e9d1c
...
...
@@ -132,11 +132,11 @@ class ConfigCommand extends FlutterCommand {
}
if
(
argResults
?.
wasParsed
(
'android-sdk'
)
??
false
)
{
_updateConfig
(
'android-sdk'
,
stringArg
(
'android-sdk'
)!);
_updateConfig
(
'android-sdk'
,
stringArg
Deprecated
(
'android-sdk'
)!);
}
if
(
argResults
?.
wasParsed
(
'android-studio-dir'
)
??
false
)
{
_updateConfig
(
'android-studio-dir'
,
stringArg
(
'android-studio-dir'
)!);
_updateConfig
(
'android-studio-dir'
,
stringArg
Deprecated
(
'android-studio-dir'
)!);
}
if
(
argResults
?.
wasParsed
(
'clear-ios-signing-cert'
)
??
false
)
{
...
...
@@ -144,7 +144,7 @@ class ConfigCommand extends FlutterCommand {
}
if
(
argResults
?.
wasParsed
(
'build-dir'
)
??
false
)
{
final
String
buildDir
=
stringArg
(
'build-dir'
)!;
final
String
buildDir
=
stringArg
Deprecated
(
'build-dir'
)!;
if
(
globals
.
fs
.
path
.
isAbsolute
(
buildDir
))
{
throwToolExit
(
'build-dir should be a relative path'
);
}
...
...
packages/flutter_tools/lib/src/commands/create.dart
View file @
596e9d1c
...
...
@@ -93,9 +93,9 @@ class CreateCommand extends CreateBase {
@override
Future
<
CustomDimensions
>
get
usageValues
async
{
return
CustomDimensions
(
commandCreateProjectType:
stringArg
(
'template'
),
commandCreateAndroidLanguage:
stringArg
(
'android-language'
),
commandCreateIosLanguage:
stringArg
(
'ios-language'
),
commandCreateProjectType:
stringArg
Deprecated
(
'template'
),
commandCreateAndroidLanguage:
stringArg
Deprecated
(
'android-language'
),
commandCreateIosLanguage:
stringArg
Deprecated
(
'ios-language'
),
);
}
...
...
@@ -162,7 +162,7 @@ class CreateCommand extends CreateBase {
FlutterProjectType
detectedProjectType
;
final
bool
metadataExists
=
projectDir
.
absolute
.
childFile
(
'.metadata'
).
existsSync
();
if
(
argResults
[
'template'
]
!=
null
)
{
template
=
stringToProjectType
(
stringArg
(
'template'
));
template
=
stringToProjectType
(
stringArg
Deprecated
(
'template'
));
}
// If the project directory exists and isn't empty, then try to determine the template
// type from the project directory.
...
...
@@ -190,7 +190,7 @@ class CreateCommand extends CreateBase {
Future
<
FlutterCommandResult
>
runCommand
()
async
{
if
(
argResults
[
'list-samples'
]
!=
null
)
{
// _writeSamplesJson can potentially be long-lived.
await
_writeSamplesJson
(
stringArg
(
'list-samples'
));
await
_writeSamplesJson
(
stringArg
Deprecated
(
'list-samples'
));
return
FlutterCommandResult
.
success
();
}
...
...
@@ -199,12 +199,12 @@ class CreateCommand extends CreateBase {
String
sampleCode
;
if
(
argResults
[
'sample'
]
!=
null
)
{
if
(
argResults
[
'template'
]
!=
null
&&
stringToProjectType
(
stringArg
(
'template'
)
??
'app'
)
!=
FlutterProjectType
.
app
)
{
stringToProjectType
(
stringArg
Deprecated
(
'template'
)
??
'app'
)
!=
FlutterProjectType
.
app
)
{
throwToolExit
(
'Cannot specify --sample with a project type other than '
'"
${flutterProjectTypeToString(FlutterProjectType.app)}
"'
);
}
// Fetch the sample from the server.
sampleCode
=
await
_fetchSampleFromServer
(
stringArg
(
'sample'
));
sampleCode
=
await
_fetchSampleFromServer
(
stringArg
Deprecated
(
'sample'
));
}
final
FlutterProjectType
template
=
_getProjectType
(
projectDir
);
...
...
@@ -276,12 +276,12 @@ class CreateCommand extends CreateBase {
organization:
organization
,
projectName:
projectName
,
titleCaseProjectName:
titleCaseProjectName
,
projectDescription:
stringArg
(
'description'
),
projectDescription:
stringArg
Deprecated
(
'description'
),
flutterRoot:
flutterRoot
,
withPlatformChannelPluginHook:
generateMethodChannelsPlugin
,
withFfiPluginHook:
generateFfiPlugin
,
androidLanguage:
stringArg
(
'android-language'
),
iosLanguage:
stringArg
(
'ios-language'
),
androidLanguage:
stringArg
Deprecated
(
'android-language'
),
iosLanguage:
stringArg
Deprecated
(
'ios-language'
),
iosDevelopmentTeam:
developmentTeam
,
ios:
includeIos
,
android:
featureFlags
.
isAndroidEnabled
&&
platforms
.
contains
(
'android'
),
...
...
@@ -438,7 +438,7 @@ Your $application code is in $relativeAppMain.
})
async
{
int
generatedCount
=
0
;
final
String
description
=
argResults
.
wasParsed
(
'description'
)
?
stringArg
(
'description'
)
?
stringArg
Deprecated
(
'description'
)
:
'A new Flutter module project.'
;
templateContext
[
'description'
]
=
description
;
generatedCount
+=
await
renderTemplate
(
...
...
@@ -472,7 +472,7 @@ Your $application code is in $relativeAppMain.
})
async
{
int
generatedCount
=
0
;
final
String
description
=
argResults
.
wasParsed
(
'description'
)
?
stringArg
(
'description'
)
?
stringArg
Deprecated
(
'description'
)
:
'A new Flutter package project.'
;
templateContext
[
'description'
]
=
description
;
generatedCount
+=
await
renderTemplate
(
...
...
@@ -518,7 +518,7 @@ Your $application code is in $relativeAppMain.
templateContext
[
'no_platforms'
]
=
!
willAddPlatforms
;
int
generatedCount
=
0
;
final
String
description
=
argResults
.
wasParsed
(
'description'
)
?
stringArg
(
'description'
)
?
stringArg
Deprecated
(
'description'
)
:
'A new Flutter plugin project.'
;
templateContext
[
'description'
]
=
description
;
generatedCount
+=
await
renderMerged
(
...
...
@@ -597,7 +597,7 @@ Your $application code is in $relativeAppMain.
templateContext
[
'no_platforms'
]
=
!
willAddPlatforms
;
int
generatedCount
=
0
;
final
String
description
=
argResults
.
wasParsed
(
'description'
)
?
stringArg
(
'description'
)
?
stringArg
Deprecated
(
'description'
)
:
'A new Flutter FFI plugin project.'
;
templateContext
[
'description'
]
=
description
;
generatedCount
+=
await
renderMerged
(
...
...
packages/flutter_tools/lib/src/commands/create_base.dart
View file @
596e9d1c
...
...
@@ -243,7 +243,7 @@ abstract class CreateBase extends FlutterCommand {
/// If `--org` is not specified, returns the organization from the existing project.
@protected
Future
<
String
>
getOrganization
()
async
{
String
organization
=
stringArg
(
'org'
);
String
organization
=
stringArg
Deprecated
(
'org'
);
if
(!
argResults
.
wasParsed
(
'org'
))
{
final
FlutterProject
project
=
FlutterProject
.
fromDirectory
(
projectDir
);
final
Set
<
String
>
existingOrganizations
=
await
project
.
organizationNames
;
...
...
@@ -315,7 +315,7 @@ abstract class CreateBase extends FlutterCommand {
@protected
String
get
projectName
{
final
String
projectName
=
stringArg
(
'project-name'
)
??
globals
.
fs
.
path
.
basename
(
projectDirPath
);
stringArg
Deprecated
(
'project-name'
)
??
globals
.
fs
.
path
.
basename
(
projectDirPath
);
if
(!
boolArg
(
'skip-name-checks'
))
{
final
String
error
=
_validateProjectName
(
projectName
);
if
(
error
!=
null
)
{
...
...
@@ -593,7 +593,7 @@ abstract class CreateBase extends FlutterCommand {
projectDirectory:
directory
,
create:
true
,
update:
false
,
currentRevision:
stringArg
(
'initial-create-revision'
)
??
globals
.
flutterVersion
.
frameworkRevision
,
currentRevision:
stringArg
Deprecated
(
'initial-create-revision'
)
??
globals
.
flutterVersion
.
frameworkRevision
,
createRevision:
globals
.
flutterVersion
.
frameworkRevision
,
logger:
globals
.
logger
,
);
...
...
packages/flutter_tools/lib/src/commands/custom_devices.dart
View file @
596e9d1c
...
...
@@ -482,7 +482,7 @@ class CustomDevicesAddCommand extends CustomDevicesCommandBase {
///
/// Only check if `--check` is explicitly specified. (Don't check by default)
Future
<
FlutterCommandResult
>
runNonInteractively
()
async
{
final
String
jsonStr
=
stringArg
(
_kJson
);
final
String
jsonStr
=
stringArg
Deprecated
(
_kJson
);
final
bool
shouldCheck
=
boolArg
(
_kCheck
)
??
false
;
dynamic
json
;
...
...
@@ -803,7 +803,7 @@ class CustomDevicesAddCommand extends CustomDevicesCommandBase {
Future
<
FlutterCommandResult
>
runCommand
()
async
{
checkFeatureEnabled
();
if
(
stringArg
(
_kJson
)
!=
null
)
{
if
(
stringArg
Deprecated
(
_kJson
)
!=
null
)
{
return
runNonInteractively
();
}
if
(
boolArg
(
_kSsh
)
==
true
)
{
...
...
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
596e9d1c
...
...
@@ -69,7 +69,7 @@ class DaemonCommand extends FlutterCommand {
if
(
argResults
[
'listen-on-tcp-port'
]
!=
null
)
{
int
port
;
try
{
port
=
int
.
parse
(
stringArg
(
'listen-on-tcp-port'
));
port
=
int
.
parse
(
stringArg
Deprecated
(
'listen-on-tcp-port'
));
}
on
FormatException
catch
(
error
)
{
throwToolExit
(
'Invalid port for `--listen-on-tcp-port`:
$error
'
);
}
...
...
packages/flutter_tools/lib/src/commands/devices.dart
View file @
596e9d1c
...
...
@@ -36,7 +36,7 @@ class DevicesCommand extends FlutterCommand {
@override
Duration
?
get
deviceDiscoveryTimeout
{
if
(
argResults
?[
'timeout'
]
!=
null
)
{
final
int
?
timeoutSeconds
=
int
.
tryParse
(
stringArg
(
'timeout'
)!);
final
int
?
timeoutSeconds
=
int
.
tryParse
(
stringArg
Deprecated
(
'timeout'
)!);
if
(
timeoutSeconds
==
null
)
{
throwToolExit
(
'Could not parse -t/--timeout argument. It must be an integer.'
);
}
...
...
packages/flutter_tools/lib/src/commands/doctor.dart
View file @
596e9d1c
...
...
@@ -35,7 +35,7 @@ class DoctorCommand extends FlutterCommand {
Future
<
FlutterCommandResult
>
runCommand
()
async
{
globals
.
flutterVersion
.
fetchTagsAndUpdate
();
if
(
argResults
?.
wasParsed
(
'check-for-remote-artifacts'
)
??
false
)
{
final
String
engineRevision
=
stringArg
(
'check-for-remote-artifacts'
)!;
final
String
engineRevision
=
stringArg
Deprecated
(
'check-for-remote-artifacts'
)!;
if
(
engineRevision
.
startsWith
(
RegExp
(
r'[a-f0-9]{1,40}'
)))
{
final
bool
success
=
await
globals
.
doctor
?.
checkRemoteArtifacts
(
engineRevision
)
??
false
;
if
(
success
)
{
...
...
packages/flutter_tools/lib/src/commands/downgrade.dart
View file @
596e9d1c
...
...
@@ -92,7 +92,7 @@ class DowngradeCommand extends FlutterCommand {
_fileSystem
??=
globals
.
fs
;
String
workingDirectory
=
Cache
.
flutterRoot
!;
if
(
argResults
!.
wasParsed
(
'working-directory'
))
{
workingDirectory
=
stringArg
(
'working-directory'
)!;
workingDirectory
=
stringArg
Deprecated
(
'working-directory'
)!;
_flutterVersion
=
FlutterVersion
(
workingDirectory:
workingDirectory
);
}
...
...
packages/flutter_tools/lib/src/commands/drive.dart
View file @
596e9d1c
...
...
@@ -179,9 +179,9 @@ class DriveCommand extends RunCommandBase {
@override
final
List
<
String
>
aliases
=
<
String
>[
'driver'
];
String
get
userIdentifier
=>
stringArg
(
FlutterOptions
.
kDeviceUser
);
String
get
userIdentifier
=>
stringArg
Deprecated
(
FlutterOptions
.
kDeviceUser
);
String
get
screenshot
=>
stringArg
(
'screenshot'
);
String
get
screenshot
=>
stringArg
Deprecated
(
'screenshot'
);
@override
bool
get
startPausedDefault
=>
true
;
...
...
@@ -209,7 +209,7 @@ class DriveCommand extends RunCommandBase {
if
(
await
_fileSystem
.
type
(
testFile
)
!=
FileSystemEntityType
.
file
)
{
throwToolExit
(
'Test file not found:
$testFile
'
);
}
final
String
applicationBinaryPath
=
stringArg
(
FlutterOptions
.
kUseApplicationBinary
);
final
String
applicationBinaryPath
=
stringArg
Deprecated
(
FlutterOptions
.
kUseApplicationBinary
);
final
Device
device
=
await
findTargetDevice
(
includeUnsupportedDevices:
applicationBinaryPath
==
null
);
if
(
device
==
null
)
{
throwToolExit
(
null
);
...
...
@@ -240,7 +240,7 @@ class DriveCommand extends RunCommandBase {
bool
screenshotTaken
=
false
;
try
{
if
(
stringArg
(
'use-existing-app'
)
==
null
)
{
if
(
stringArg
Deprecated
(
'use-existing-app'
)
==
null
)
{
await
driverService
.
start
(
buildInfo
,
device
,
...
...
@@ -260,9 +260,9 @@ class DriveCommand extends RunCommandBase {
}
);
}
else
{
final
Uri
uri
=
Uri
.
tryParse
(
stringArg
(
'use-existing-app'
));
final
Uri
uri
=
Uri
.
tryParse
(
stringArg
Deprecated
(
'use-existing-app'
));
if
(
uri
==
null
)
{
throwToolExit
(
'Invalid VM Service URI:
${stringArg('use-existing-app')}
'
);
throwToolExit
(
'Invalid VM Service URI:
${stringArg
Deprecated
('use-existing-app')}
'
);
}
await
driverService
.
reuseApplication
(
uri
,
...
...
@@ -277,15 +277,15 @@ class DriveCommand extends RunCommandBase {
stringsArg
(
'test-arguments'
),
<
String
,
String
>{},
packageConfig
,
chromeBinary:
stringArg
(
'chrome-binary'
),
chromeBinary:
stringArg
Deprecated
(
'chrome-binary'
),
headless:
boolArg
(
'headless'
),
browserDimension:
stringArg
(
'browser-dimension'
).
split
(
','
),
browserName:
stringArg
(
'browser-name'
),
driverPort:
stringArg
(
'driver-port'
)
!=
null
?
int
.
tryParse
(
stringArg
(
'driver-port'
))
browserDimension:
stringArg
Deprecated
(
'browser-dimension'
).
split
(
','
),
browserName:
stringArg
Deprecated
(
'browser-name'
),
driverPort:
stringArg
Deprecated
(
'driver-port'
)
!=
null
?
int
.
tryParse
(
stringArg
Deprecated
(
'driver-port'
))
:
null
,
androidEmulator:
boolArg
(
'android-emulator'
),
profileMemory:
stringArg
(
'profile-memory'
),
profileMemory:
stringArg
Deprecated
(
'profile-memory'
),
);
if
(
testResult
!=
0
&&
screenshot
!=
null
)
{
// Take a screenshot while the app is still running.
...
...
@@ -296,8 +296,8 @@ class DriveCommand extends RunCommandBase {
if
(
boolArg
(
'keep-app-running'
)
??
(
argResults
[
'use-existing-app'
]
!=
null
))
{
_logger
.
printStatus
(
'Leaving the application running.'
);
}
else
{
final
File
skslFile
=
stringArg
(
'write-sksl-on-exit'
)
!=
null
?
_fileSystem
.
file
(
stringArg
(
'write-sksl-on-exit'
))
final
File
skslFile
=
stringArg
Deprecated
(
'write-sksl-on-exit'
)
!=
null
?
_fileSystem
.
file
(
stringArg
Deprecated
(
'write-sksl-on-exit'
))
:
null
;
await
driverService
.
stop
(
userIdentifier:
userIdentifier
,
writeSkslOnExit:
skslFile
);
}
...
...
@@ -318,7 +318,7 @@ class DriveCommand extends RunCommandBase {
String
_getTestFile
()
{
if
(
argResults
[
'driver'
]
!=
null
)
{
return
stringArg
(
'driver'
);
return
stringArg
Deprecated
(
'driver'
);
}
// If the --driver argument wasn't provided, then derive the value from
...
...
packages/flutter_tools/lib/src/commands/emulators.dart
View file @
596e9d1c
...
...
@@ -48,9 +48,9 @@ class EmulatorsCommand extends FlutterCommand {
final
ArgResults
argumentResults
=
argResults
!;
if
(
argumentResults
.
wasParsed
(
'launch'
))
{
final
bool
coldBoot
=
argumentResults
.
wasParsed
(
'cold'
);
await
_launchEmulator
(
stringArg
(
'launch'
)!,
coldBoot:
coldBoot
);
await
_launchEmulator
(
stringArg
Deprecated
(
'launch'
)!,
coldBoot:
coldBoot
);
}
else
if
(
argumentResults
.
wasParsed
(
'create'
))
{
await
_createEmulator
(
name:
stringArg
(
'name'
));
await
_createEmulator
(
name:
stringArg
Deprecated
(
'name'
));
}
else
{
final
String
?
searchText
=
argumentResults
.
rest
!=
null
&&
argumentResults
.
rest
.
isNotEmpty
...
...
packages/flutter_tools/lib/src/commands/generate_localizations.dart
View file @
596e9d1c
...
...
@@ -216,19 +216,19 @@ class GenerateLocalizationsCommand extends FlutterCommand {
return
FlutterCommandResult
.
success
();
}
final
String
inputPathString
=
stringArg
(
'arb-dir'
)!;
// Has default value, cannot be null.
final
String
?
outputPathString
=
stringArg
(
'output-dir'
);
final
String
outputFileString
=
stringArg
(
'output-localization-file'
)!;
// Has default value, cannot be null.
final
String
templateArbFileName
=
stringArg
(
'template-arb-file'
)!;
// Has default value, cannot be null.
final
String
?
untranslatedMessagesFile
=
stringArg
(
'untranslated-messages-file'
);
final
String
classNameString
=
stringArg
(
'output-class'
)!;
// Has default value, cannot be null.
final
String
inputPathString
=
stringArg
Deprecated
(
'arb-dir'
)!;
// Has default value, cannot be null.
final
String
?
outputPathString
=
stringArg
Deprecated
(
'output-dir'
);
final
String
outputFileString
=
stringArg
Deprecated
(
'output-localization-file'
)!;
// Has default value, cannot be null.
final
String
templateArbFileName
=
stringArg
Deprecated
(
'template-arb-file'
)!;
// Has default value, cannot be null.
final
String
?
untranslatedMessagesFile
=
stringArg
Deprecated
(
'untranslated-messages-file'
);
final
String
classNameString
=
stringArg
Deprecated
(
'output-class'
)!;
// Has default value, cannot be null.
final
List
<
String
>
preferredSupportedLocales
=
stringsArg
(
'preferred-supported-locales'
);
final
String
?
headerString
=
stringArg
(
'header'
);
final
String
?
headerFile
=
stringArg
(
'header-file'
);
final
String
?
headerString
=
stringArg
Deprecated
(
'header'
);
final
String
?
headerFile
=
stringArg
Deprecated
(
'header-file'
);
final
bool
useDeferredLoading
=
boolArg
(
'use-deferred-loading'
);
final
String
?
inputsAndOutputsListPath
=
stringArg
(
'gen-inputs-and-outputs-list'
);
final
String
?
inputsAndOutputsListPath
=
stringArg
Deprecated
(
'gen-inputs-and-outputs-list'
);
final
bool
useSyntheticPackage
=
boolArg
(
'synthetic-package'
);
final
String
?
projectPathString
=
stringArg
(
'project-dir'
);
final
String
?
projectPathString
=
stringArg
Deprecated
(
'project-dir'
);
final
bool
areResourceAttributesRequired
=
boolArg
(
'required-resource-attributes'
);
final
bool
usesNullableGetter
=
boolArg
(
'nullable-getter'
);
...
...
packages/flutter_tools/lib/src/commands/install.dart
View file @
596e9d1c
...
...
@@ -34,9 +34,9 @@ class InstallCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts
Device
?
device
;
bool
get
uninstallOnly
=>
boolArg
(
'uninstall-only'
);
String
?
get
userIdentifier
=>
stringArg
(
FlutterOptions
.
kDeviceUser
);
String
?
get
userIdentifier
=>
stringArg
Deprecated
(
FlutterOptions
.
kDeviceUser
);
String
?
get
_applicationBinaryPath
=>
stringArg
(
FlutterOptions
.
kUseApplicationBinary
);
String
?
get
_applicationBinaryPath
=>
stringArg
Deprecated
(
FlutterOptions
.
kUseApplicationBinary
);
File
?
get
_applicationBinary
=>
_applicationBinaryPath
==
null
?
null
:
globals
.
fs
.
file
(
_applicationBinaryPath
);
@override
...
...
packages/flutter_tools/lib/src/commands/run.dart
View file @
596e9d1c
...
...
@@ -179,25 +179,25 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
/// Whether to start the application paused by default.
bool
get
startPausedDefault
;
String
get
route
=>
stringArg
(
'route'
);
String
get
route
=>
stringArg
Deprecated
(
'route'
);
String
get
traceAllowlist
=>
stringArg
(
'trace-allowlist'
);
String
get
traceAllowlist
=>
stringArg
Deprecated
(
'trace-allowlist'
);
/// Create a debugging options instance for the current `run` or `drive` invocation.
Future
<
DebuggingOptions
>
createDebuggingOptions
(
bool
webMode
)
async
{
final
BuildInfo
buildInfo
=
await
getBuildInfo
();
final
int
browserDebugPort
=
featureFlags
.
isWebEnabled
&&
argResults
.
wasParsed
(
'web-browser-debug-port'
)
?
int
.
parse
(
stringArg
(
'web-browser-debug-port'
))
?
int
.
parse
(
stringArg
Deprecated
(
'web-browser-debug-port'
))
:
null
;
if
(
buildInfo
.
mode
.
isRelease
)
{
return
DebuggingOptions
.
disabled
(
buildInfo
,
dartEntrypointArgs:
stringsArg
(
'dart-entrypoint-args'
),
hostname:
featureFlags
.
isWebEnabled
?
stringArg
(
'web-hostname'
)
:
''
,
port:
featureFlags
.
isWebEnabled
?
stringArg
(
'web-port'
)
:
''
,
webUseSseForDebugProxy:
featureFlags
.
isWebEnabled
&&
stringArg
(
'web-server-debug-protocol'
)
==
'sse'
,
webUseSseForDebugBackend:
featureFlags
.
isWebEnabled
&&
stringArg
(
'web-server-debug-backend-protocol'
)
==
'sse'
,
webUseSseForInjectedClient:
featureFlags
.
isWebEnabled
&&
stringArg
(
'web-server-debug-injected-client-protocol'
)
==
'sse'
,
hostname:
featureFlags
.
isWebEnabled
?
stringArg
Deprecated
(
'web-hostname'
)
:
''
,
port:
featureFlags
.
isWebEnabled
?
stringArg
Deprecated
(
'web-port'
)
:
''
,
webUseSseForDebugProxy:
featureFlags
.
isWebEnabled
&&
stringArg
Deprecated
(
'web-server-debug-protocol'
)
==
'sse'
,
webUseSseForDebugBackend:
featureFlags
.
isWebEnabled
&&
stringArg
Deprecated
(
'web-server-debug-backend-protocol'
)
==
'sse'
,
webUseSseForInjectedClient:
featureFlags
.
isWebEnabled
&&
stringArg
Deprecated
(
'web-server-debug-injected-client-protocol'
)
==
'sse'
,
webEnableExposeUrl:
featureFlags
.
isWebEnabled
&&
boolArg
(
'web-allow-expose-url'
),
webRunHeadless:
featureFlags
.
isWebEnabled
&&
boolArg
(
'web-run-headless'
),
webBrowserDebugPort:
browserDebugPort
,
...
...
@@ -212,13 +212,13 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
cacheStartupProfile:
cacheStartupProfile
,
enableDds:
enableDds
,
dartEntrypointArgs:
stringsArg
(
'dart-entrypoint-args'
),
dartFlags:
stringArg
(
'dart-flags'
)
??
''
,
dartFlags:
stringArg
Deprecated
(
'dart-flags'
)
??
''
,
useTestFonts:
argParser
.
options
.
containsKey
(
'use-test-fonts'
)
&&
boolArg
(
'use-test-fonts'
),
enableSoftwareRendering:
argParser
.
options
.
containsKey
(
'enable-software-rendering'
)
&&
boolArg
(
'enable-software-rendering'
),
skiaDeterministicRendering:
argParser
.
options
.
containsKey
(
'skia-deterministic-rendering'
)
&&
boolArg
(
'skia-deterministic-rendering'
),
traceSkia:
boolArg
(
'trace-skia'
),
traceAllowlist:
traceAllowlist
,
traceSkiaAllowlist:
stringArg
(
'trace-skia-allowlist'
),
traceSkiaAllowlist:
stringArg
Deprecated
(
'trace-skia-allowlist'
),
traceSystrace:
boolArg
(
'trace-systrace'
),
endlessTraceBuffer:
boolArg
(
'endless-trace-buffer'
),
dumpSkpOnShaderCompilation:
dumpSkpOnShaderCompilation
,
...
...
@@ -230,17 +230,17 @@ abstract class RunCommandBase extends FlutterCommand with DeviceBasedDevelopment
ddsPort:
ddsPort
,
devToolsServerAddress:
devToolsServerAddress
,
verboseSystemLogs:
boolArg
(
'verbose-system-logs'
),
hostname:
featureFlags
.
isWebEnabled
?
stringArg
(
'web-hostname'
)
:
''
,
port:
featureFlags
.
isWebEnabled
?
stringArg
(
'web-port'
)
:
''
,
webUseSseForDebugProxy:
featureFlags
.
isWebEnabled
&&
stringArg
(
'web-server-debug-protocol'
)
==
'sse'
,
webUseSseForDebugBackend:
featureFlags
.
isWebEnabled
&&
stringArg
(
'web-server-debug-backend-protocol'
)
==
'sse'
,
webUseSseForInjectedClient:
featureFlags
.
isWebEnabled
&&
stringArg
(
'web-server-debug-injected-client-protocol'
)
==
'sse'
,
hostname:
featureFlags
.
isWebEnabled
?
stringArg
Deprecated
(
'web-hostname'
)
:
''
,
port:
featureFlags
.
isWebEnabled
?
stringArg
Deprecated
(
'web-port'
)
:
''
,
webUseSseForDebugProxy:
featureFlags
.
isWebEnabled
&&
stringArg
Deprecated
(
'web-server-debug-protocol'
)
==
'sse'
,
webUseSseForDebugBackend:
featureFlags
.
isWebEnabled
&&
stringArg
Deprecated
(
'web-server-debug-backend-protocol'
)
==
'sse'
,
webUseSseForInjectedClient:
featureFlags
.
isWebEnabled
&&
stringArg
Deprecated
(
'web-server-debug-injected-client-protocol'
)
==
'sse'
,
webEnableExposeUrl:
featureFlags
.
isWebEnabled
&&
boolArg
(
'web-allow-expose-url'
),
webRunHeadless:
featureFlags
.
isWebEnabled
&&
boolArg
(
'web-run-headless'
),
webBrowserDebugPort:
browserDebugPort
,
webEnableExpressionEvaluation:
featureFlags
.
isWebEnabled
&&
boolArg
(
'web-enable-expression-evaluation'
),
webLaunchUrl:
featureFlags
.
isWebEnabled
?
stringArg
(
'web-launch-url'
)
:
null
,
vmserviceOutFile:
stringArg
(
'vmservice-out-file'
),
webLaunchUrl:
featureFlags
.
isWebEnabled
?
stringArg
Deprecated
(
'web-launch-url'
)
:
null
,
vmserviceOutFile:
stringArg
Deprecated
(
'vmservice-out-file'
),
fastStart:
argParser
.
options
.
containsKey
(
'fast-start'
)
&&
boolArg
(
'fast-start'
)
&&
!
runningWithPrebuiltApplication
,
...
...
@@ -371,7 +371,7 @@ class RunCommand extends RunCommandBase {
List
<
Device
>
devices
;
bool
webMode
=
false
;
String
get
userIdentifier
=>
stringArg
(
FlutterOptions
.
kDeviceUser
);
String
get
userIdentifier
=>
stringArg
Deprecated
(
FlutterOptions
.
kDeviceUser
);
@override
bool
get
startPausedDefault
=>
false
;
...
...
@@ -523,8 +523,8 @@ class RunCommand extends RunCommandBase {
applicationBinary:
applicationBinaryPath
==
null
?
null
:
globals
.
fs
.
file
(
applicationBinaryPath
),
projectRootPath:
stringArg
(
'project-root'
),
dillOutputPath:
stringArg
(
'output-dill'
),
projectRootPath:
stringArg
Deprecated
(
'project-root'
),
dillOutputPath:
stringArg
Deprecated
(
'output-dill'
),
stayResident:
stayResident
,
ipv6:
ipv6
,
multidexEnabled:
boolArg
(
'multidex'
),
...
...
@@ -580,7 +580,7 @@ class RunCommand extends RunCommandBase {
// debug mode.
final
BuildInfo
buildInfo
=
await
getBuildInfo
();
final
bool
hotMode
=
shouldUseHotMode
(
buildInfo
);
final
String
applicationBinaryPath
=
stringArg
(
FlutterOptions
.
kUseApplicationBinary
);
final
String
applicationBinaryPath
=
stringArg
Deprecated
(
FlutterOptions
.
kUseApplicationBinary
);
if
(
boolArg
(
'machine'
))
{
if
(
devices
.
length
>
1
)
{
...
...
@@ -596,9 +596,9 @@ class RunCommand extends RunCommandBase {
?
null
:
globals
.
fs
.
file
(
applicationBinaryPath
),
trackWidgetCreation:
trackWidgetCreation
,
projectRootPath:
stringArg
(
'project-root'
),
projectRootPath:
stringArg
Deprecated
(
'project-root'
),
packagesFilePath:
globalResults
[
'packages'
]
as
String
,
dillOutputPath:
stringArg
(
'output-dill'
),
dillOutputPath:
stringArg
Deprecated
(
'output-dill'
),
ipv6:
ipv6
,
multidexEnabled:
boolArg
(
'multidex'
),
);
...
...
@@ -691,7 +691,7 @@ class RunCommand extends RunCommandBase {
signals:
globals
.
signals
,
processInfo:
globals
.
processInfo
,
reportReady:
boolArg
(
'report-ready'
),
pidFile:
stringArg
(
'pid-file'
),
pidFile:
stringArg
Deprecated
(
'pid-file'
),
)
..
registerSignalHandlers
()
..
setupTerminal
();
...
...
packages/flutter_tools/lib/src/commands/screenshot.dart
View file @
596e9d1c
...
...
@@ -93,7 +93,7 @@ class ScreenshotCommand extends FlutterCommand {
@override
Future
<
FlutterCommandResult
>
verifyThenRunCommand
(
String
?
commandPath
)
async
{
await
_validateOptions
(
stringArg
(
_kType
),
stringArg
(
_kObservatoryUrl
));
await
_validateOptions
(
stringArg
Deprecated
(
_kType
),
stringArgDeprecated
(
_kObservatoryUrl
));
return
super
.
verifyThenRunCommand
(
commandPath
);
}
...
...
@@ -101,11 +101,11 @@ class ScreenshotCommand extends FlutterCommand {
Future
<
FlutterCommandResult
>
runCommand
()
async
{
File
?
outputFile
;
if
(
argResults
?.
wasParsed
(
_kOut
)
??
false
)
{
outputFile
=
globals
.
fs
.
file
(
stringArg
(
_kOut
));
outputFile
=
globals
.
fs
.
file
(
stringArg
Deprecated
(
_kOut
));
}
bool
success
=
true
;
switch
(
stringArg
(
_kType
))
{
switch
(
stringArg
Deprecated
(
_kType
))
{
case
_kDeviceType:
await
runScreenshot
(
outputFile
);
break
;
...
...
@@ -136,7 +136,7 @@ class ScreenshotCommand extends FlutterCommand {
}
Future
<
bool
>
runSkia
(
File
?
outputFile
)
async
{
final
Uri
observatoryUrl
=
Uri
.
parse
(
stringArg
(
_kObservatoryUrl
)!);
final
Uri
observatoryUrl
=
Uri
.
parse
(
stringArg
Deprecated
(
_kObservatoryUrl
)!);
final
FlutterVmService
vmService
=
await
connectToVmService
(
observatoryUrl
,
logger:
globals
.
logger
);
final
vm_service
.
Response
?
skp
=
await
vmService
.
screenshotSkp
();
if
(
skp
==
null
)
{
...
...
@@ -160,7 +160,7 @@ class ScreenshotCommand extends FlutterCommand {
}
Future
<
bool
>
runRasterizer
(
File
?
outputFile
)
async
{
final
Uri
observatoryUrl
=
Uri
.
parse
(
stringArg
(
_kObservatoryUrl
)!);
final
Uri
observatoryUrl
=
Uri
.
parse
(
stringArg
Deprecated
(
_kObservatoryUrl
)!);
final
FlutterVmService
vmService
=
await
connectToVmService
(
observatoryUrl
,
logger:
globals
.
logger
);
final
vm_service
.
Response
?
response
=
await
vmService
.
screenshot
();
if
(
response
==
null
)
{
...
...
packages/flutter_tools/lib/src/commands/symbolize.dart
View file @
596e9d1c
...
...
@@ -68,11 +68,11 @@ class SymbolizeCommand extends FlutterCommand {
if
(
argResults
?.
wasParsed
(
'debug-info'
)
!=
true
)
{
throwToolExit
(
'"--debug-info" is required to symbolize stack traces.'
);
}
if
(!
_fileSystem
.
isFileSync
(
stringArg
(
'debug-info'
)!))
{
throwToolExit
(
'
${stringArg('debug-info')}
does not exist.'
);
if
(!
_fileSystem
.
isFileSync
(
stringArg
Deprecated
(
'debug-info'
)!))
{
throwToolExit
(
'
${stringArg
Deprecated
('debug-info')}
does not exist.'
);
}
if
((
argResults
?.
wasParsed
(
'input'
)
??
false
)
&&
!
_fileSystem
.
isFileSync
(
stringArg
(
'input'
)!))
{
throwToolExit
(
'
${stringArg('input')}
does not exist.'
);
if
((
argResults
?.
wasParsed
(
'input'
)
??
false
)
&&
!
_fileSystem
.
isFileSync
(
stringArg
Deprecated
(
'input'
)!))
{
throwToolExit
(
'
${stringArg
Deprecated
('input')}
does not exist.'
);
}
return
super
.
validateCommand
();
}
...
...
@@ -84,7 +84,7 @@ class SymbolizeCommand extends FlutterCommand {
// Configure output to either specified file or stdout.
if
(
argResults
?.
wasParsed
(
'output'
)
??
false
)
{
final
File
outputFile
=
_fileSystem
.
file
(
stringArg
(
'output'
));
final
File
outputFile
=
_fileSystem
.
file
(
stringArg
Deprecated
(
'output'
));
if
(!
outputFile
.
parent
.
existsSync
())
{
outputFile
.
parent
.
createSync
(
recursive:
true
);
}
...
...
@@ -100,12 +100,12 @@ class SymbolizeCommand extends FlutterCommand {
// Configure input from either specified file or stdin.
if
(
argResults
?.
wasParsed
(
'input'
)
??
false
)
{
input
=
_fileSystem
.
file
(
stringArg
(
'input'
)).
openRead
();
input
=
_fileSystem
.
file
(
stringArg
Deprecated
(
'input'
)).
openRead
();
}
else
{
input
=
_stdio
.
stdin
;
}
final
Uint8List
symbols
=
_fileSystem
.
file
(
stringArg
(
'debug-info'
)).
readAsBytesSync
();
final
Uint8List
symbols
=
_fileSystem
.
file
(
stringArg
Deprecated
(
'debug-info'
)).
readAsBytesSync
();
await
_dwarfSymbolizationService
.
decode
(
input:
input
,
output:
output
,
...
...
packages/flutter_tools/lib/src/commands/test.dart
View file @
596e9d1c
...
...
@@ -239,7 +239,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
// Use [DeviceBasedDevelopmentArtifacts].
?
await
super
.
requiredArtifacts
:
<
DevelopmentArtifact
>{};
if
(
stringArg
(
'platform'
)
==
'chrome'
)
{
if
(
stringArg
Deprecated
(
'platform'
)
==
'chrome'
)
{
results
.
add
(
DevelopmentArtifact
.
web
);
}
return
results
;
...
...
@@ -305,8 +305,8 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
final
bool
buildTestAssets
=
boolArg
(
'test-assets'
);
final
List
<
String
>
names
=
stringsArg
(
'name'
);
final
List
<
String
>
plainNames
=
stringsArg
(
'plain-name'
);
final
String
tags
=
stringArg
(
'tags'
);
final
String
excludeTags
=
stringArg
(
'exclude-tags'
);
final
String
tags
=
stringArg
Deprecated
(
'tags'
);
final
String
excludeTags
=
stringArg
Deprecated
(
'exclude-tags'
);
final
BuildInfo
buildInfo
=
await
getBuildInfo
(
forcedBuildMode:
BuildMode
.
debug
);
if
(
buildInfo
.
packageConfig
[
'test_api'
]
==
null
)
{
...
...
@@ -332,7 +332,7 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
);
}
int
jobs
=
int
.
tryParse
(
stringArg
(
'concurrency'
));
int
jobs
=
int
.
tryParse
(
stringArg
Deprecated
(
'concurrency'
));
if
(
jobs
==
null
||
jobs
<=
0
||
!
jobs
.
isFinite
)
{
throwToolExit
(
'Could not parse -j/--concurrency argument. It must be an integer greater than zero.'
...
...
@@ -350,13 +350,13 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
jobs
=
1
;
}
final
int
shardIndex
=
int
.
tryParse
(
stringArg
(
'shard-index'
)
??
''
);
final
int
shardIndex
=
int
.
tryParse
(
stringArg
Deprecated
(
'shard-index'
)
??
''
);
if
(
shardIndex
!=
null
&&
(
shardIndex
<
0
||
!
shardIndex
.
isFinite
))
{
throwToolExit
(
'Could not parse --shard-index=
$shardIndex
argument. It must be an integer greater than -1.'
);
}
final
int
totalShards
=
int
.
tryParse
(
stringArg
(
'total-shards'
)
??
''
);
final
int
totalShards
=
int
.
tryParse
(
stringArg
Deprecated
(
'total-shards'
)
??
''
);
if
(
totalShards
!=
null
&&
(
totalShards
<=
0
||
!
totalShards
.
isFinite
))
{
throwToolExit
(
'Could not parse --total-shards=
$totalShards
argument. It must be an integer greater than zero.'
);
...
...
@@ -446,20 +446,20 @@ class TestCommand extends FlutterCommand with DeviceBasedDevelopmentArtifacts {
concurrency:
jobs
,
buildTestAssets:
buildTestAssets
,
flutterProject:
flutterProject
,
web:
stringArg
(
'platform'
)
==
'chrome'
,
randomSeed:
stringArg
(
'test-randomize-ordering-seed'
),
reporter:
stringArg
(
'reporter'
),
timeout:
stringArg
(
'timeout'
),
web:
stringArg
Deprecated
(
'platform'
)
==
'chrome'
,
randomSeed:
stringArg
Deprecated
(
'test-randomize-ordering-seed'
),
reporter:
stringArg
Deprecated
(
'reporter'
),
timeout:
stringArg
Deprecated
(
'timeout'
),
runSkipped:
boolArg
(
'run-skipped'
),
shardIndex:
shardIndex
,
totalShards:
totalShards
,
integrationTestDevice:
integrationTestDevice
,
integrationTestUserIdentifier:
stringArg
(
FlutterOptions
.
kDeviceUser
),
integrationTestUserIdentifier:
stringArg
Deprecated
(
FlutterOptions
.
kDeviceUser
),
);
if
(
collector
!=
null
)
{
final
bool
collectionResult
=
collector
.
collectCoverageData
(
stringArg
(
'coverage-path'
),
stringArg
Deprecated
(
'coverage-path'
),
mergeCoverageData:
boolArg
(
'merge-coverage'
),
);
if
(!
collectionResult
)
{
...
...
packages/flutter_tools/lib/src/commands/update_packages.dart
View file @
596e9d1c
...
...
@@ -462,7 +462,7 @@ class UpdatePackagesCommand extends FlutterCommand {
}
if
(
boolArg
(
'paths'
))
{
showDependencyPaths
(
from:
stringArg
(
'from'
)!,
to:
stringArg
(
'to'
)!,
tree:
tree
);
showDependencyPaths
(
from:
stringArg
Deprecated
(
'from'
)!,
to:
stringArgDeprecated
(
'to'
)!,
tree:
tree
);
return
true
;
}
...
...
@@ -496,7 +496,7 @@ class UpdatePackagesCommand extends FlutterCommand {
);
try
{
// int.tryParse will not accept null, but will convert empty string to null
final
int
?
maxJobs
=
int
.
tryParse
(
stringArg
(
'jobs'
)
??
''
);
final
int
?
maxJobs
=
int
.
tryParse
(
stringArg
Deprecated
(
'jobs'
)
??
''
);
final
TaskQueue
<
void
>
queue
=
TaskQueue
<
void
>(
maxJobs:
maxJobs
);
for
(
final
Directory
dir
in
packages
)
{
unawaited
(
queue
.
add
(()
async
{
...
...
packages/flutter_tools/lib/src/commands/upgrade.dart
View file @
596e9d1c
...
...
@@ -70,13 +70,13 @@ class UpgradeCommand extends FlutterCommand {
@override
Future
<
FlutterCommandResult
>
runCommand
()
{
_commandRunner
.
workingDirectory
=
stringArg
(
'working-directory'
)
??
Cache
.
flutterRoot
!;
_commandRunner
.
workingDirectory
=
stringArg
Deprecated
(
'working-directory'
)
??
Cache
.
flutterRoot
!;
return
_commandRunner
.
runCommand
(
force:
boolArg
(
'force'
),
continueFlow:
boolArg
(
'continue'
),
testFlow:
stringArg
(
'working-directory'
)
!=
null
,
testFlow:
stringArg
Deprecated
(
'working-directory'
)
!=
null
,
gitTagVersion:
GitTagVersion
.
determine
(
globals
.
processUtils
,
globals
.
platform
),
flutterVersion:
stringArg
(
'working-directory'
)
==
null
flutterVersion:
stringArg
Deprecated
(
'working-directory'
)
==
null
?
globals
.
flutterVersion
:
FlutterVersion
(
workingDirectory:
_commandRunner
.
workingDirectory
),
verifyOnly:
boolArg
(
'verify-only'
),
...
...
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
596e9d1c
...
...
@@ -293,7 +293,7 @@ abstract class FlutterCommand extends Command<void> {
String
get
targetFile
{
if
(
argResults
?.
wasParsed
(
'target'
)
??
false
)
{
return
stringArg
(
'target'
)!;
return
stringArg
Deprecated
(
'target'
)!;
}
final
List
<
String
>?
rest
=
argResults
?.
rest
;
if
(
rest
!=
null
&&
rest
.
isNotEmpty
)
{
...
...
@@ -312,7 +312,7 @@ abstract class FlutterCommand extends Command<void> {
/// This can be overridden by some of its subclasses.
String
?
get
fileSystemScheme
=>
argParser
.
options
.
containsKey
(
FlutterOptions
.
kFileSystemScheme
)
?
stringArg
(
FlutterOptions
.
kFileSystemScheme
)
?
stringArg
Deprecated
(
FlutterOptions
.
kFileSystemScheme
)
:
null
;
/// The values of the `--filesystem-root` argument.
...
...
@@ -450,8 +450,8 @@ abstract class FlutterCommand extends Command<void> {
||
(
argResults
?.
wasParsed
(
'host-vmservice-port'
)
??
false
);
int
_tryParseHostVmservicePort
()
{
final
String
?
observatoryPort
=
stringArg
(
'observatory-port'
);
final
String
?
hostPort
=
stringArg
(
'host-vmservice-port'
);
final
String
?
observatoryPort
=
stringArg
Deprecated
(
'observatory-port'
);
final
String
?
hostPort
=
stringArg
Deprecated
(
'host-vmservice-port'
);
if
(
observatoryPort
==
null
&&
hostPort
==
null
)
{
throwToolExit
(
'Invalid port for `--observatory-port/--host-vmservice-port`'
);
}
...
...
@@ -468,7 +468,7 @@ abstract class FlutterCommand extends Command<void> {
return
_tryParseHostVmservicePort
();
}
else
if
(
argResults
?.
wasParsed
(
'dds-port'
)
??
false
)
{
// If an explicit DDS port is provided, use dds-port for DDS.
return
int
.
tryParse
(
stringArg
(
'dds-port'
)!)
??
0
;
return
int
.
tryParse
(
stringArg
Deprecated
(
'dds-port'
)!)
??
0
;
}
// Otherwise, DDS can bind to a random port.
return
0
;
...
...
@@ -476,7 +476,7 @@ abstract class FlutterCommand extends Command<void> {
Uri
?
get
devToolsServerAddress
{
if
(
argResults
?.
wasParsed
(
kDevToolsServerAddress
)
??
false
)
{
final
Uri
?
uri
=
Uri
.
tryParse
(
stringArg
(
kDevToolsServerAddress
)!);
final
Uri
?
uri
=
Uri
.
tryParse
(
stringArg
Deprecated
(
kDevToolsServerAddress
)!);
if
(
uri
!=
null
&&
uri
.
host
.
isNotEmpty
&&
uri
.
port
!=
0
)
{
return
uri
;
}
...
...
@@ -513,7 +513,7 @@ abstract class FlutterCommand extends Command<void> {
///
/// If no port is set, returns null.
int
?
get
deviceVmservicePort
{
final
String
?
devicePort
=
stringArg
(
'device-vmservice-port'
);
final
String
?
devicePort
=
stringArg
Deprecated
(
'device-vmservice-port'
);
if
(!
_usesPortOption
||
devicePort
==
null
)
{
return
null
;
}
...
...
@@ -626,7 +626,7 @@ abstract class FlutterCommand extends Command<void> {
late
final
Duration
?
deviceDiscoveryTimeout
=
()
{
if
((
argResults
?.
options
.
contains
(
FlutterOptions
.
kDeviceTimeout
)
??
false
)
&&
(
argResults
?.
wasParsed
(
FlutterOptions
.
kDeviceTimeout
)
??
false
))
{
final
int
?
timeoutSeconds
=
int
.
tryParse
(
stringArg
(
FlutterOptions
.
kDeviceTimeout
)!);
final
int
?
timeoutSeconds
=
int
.
tryParse
(
stringArg
Deprecated
(
FlutterOptions
.
kDeviceTimeout
)!);
if
(
timeoutSeconds
==
null
)
{
throwToolExit
(
'Could not parse "--
${FlutterOptions.kDeviceTimeout}
" argument. It must be an integer.'
);
}
...
...
@@ -980,7 +980,7 @@ abstract class FlutterCommand extends Command<void> {
boolArg
(
'track-widget-creation'
);
final
String
?
buildNumber
=
argParser
.
options
.
containsKey
(
'build-number'
)
?
stringArg
(
'build-number'
)
?
stringArg
Deprecated
(
'build-number'
)
:
null
;
final
File
packagesFile
=
globals
.
fs
.
file
(
...
...
@@ -1015,8 +1015,8 @@ abstract class FlutterCommand extends Command<void> {
globals
.
fs
.
directory
(
getBuildDirectory
()),
'flutter_size'
,
);
if
(
argParser
.
options
.
containsKey
(
FlutterOptions
.
kCodeSizeDirectory
)
&&
stringArg
(
FlutterOptions
.
kCodeSizeDirectory
)
!=
null
)
{
directory
=
globals
.
fs
.
directory
(
stringArg
(
FlutterOptions
.
kCodeSizeDirectory
));
if
(
argParser
.
options
.
containsKey
(
FlutterOptions
.
kCodeSizeDirectory
)
&&
stringArg
Deprecated
(
FlutterOptions
.
kCodeSizeDirectory
)
!=
null
)
{
directory
=
globals
.
fs
.
directory
(
stringArg
Deprecated
(
FlutterOptions
.
kCodeSizeDirectory
));
}
directory
.
createSync
(
recursive:
true
);
codeSizeDirectory
=
directory
.
path
;
...
...
@@ -1059,7 +1059,7 @@ abstract class FlutterCommand extends Command<void> {
&&
boolArg
(
FlutterOptions
.
kDartObfuscationOption
);
final
String
?
splitDebugInfoPath
=
argParser
.
options
.
containsKey
(
FlutterOptions
.
kSplitDebugInfoOption
)
?
stringArg
(
FlutterOptions
.
kSplitDebugInfoOption
)
?
stringArg
Deprecated
(
FlutterOptions
.
kSplitDebugInfoOption
)
:
null
;
final
bool
androidGradleDaemon
=
!
argParser
.
options
.
containsKey
(
FlutterOptions
.
kAndroidGradleDaemon
)
...
...
@@ -1088,7 +1088,7 @@ abstract class FlutterCommand extends Command<void> {
&&
boolArg
(
'tree-shake-icons'
);
final
String
?
bundleSkSLPath
=
argParser
.
options
.
containsKey
(
FlutterOptions
.
kBundleSkSLPathOption
)
?
stringArg
(
FlutterOptions
.
kBundleSkSLPathOption
)
?
stringArg
Deprecated
(
FlutterOptions
.
kBundleSkSLPathOption
)
:
null
;
if
(
bundleSkSLPath
!=
null
&&
!
globals
.
fs
.
isFileSync
(
bundleSkSLPath
))
{
...
...
@@ -1096,7 +1096,7 @@ abstract class FlutterCommand extends Command<void> {
}
final
String
?
performanceMeasurementFile
=
argParser
.
options
.
containsKey
(
FlutterOptions
.
kPerformanceMeasurementFile
)
?
stringArg
(
FlutterOptions
.
kPerformanceMeasurementFile
)
?
stringArg
Deprecated
(
FlutterOptions
.
kPerformanceMeasurementFile
)
:
null
;
List
<
String
>
dartDefines
=
argParser
.
options
.
containsKey
(
FlutterOptions
.
kDartDefinesOption
)
...
...
@@ -1104,12 +1104,12 @@ abstract class FlutterCommand extends Command<void> {
:
<
String
>[];
if
(
argParser
.
options
.
containsKey
(
'web-renderer'
))
{
dartDefines
=
updateDartDefines
(
dartDefines
,
stringArg
(
'web-renderer'
)!);
dartDefines
=
updateDartDefines
(
dartDefines
,
stringArg
Deprecated
(
'web-renderer'
)!);
}
return
BuildInfo
(
buildMode
,
argParser
.
options
.
containsKey
(
'flavor'
)
?
stringArg
(
'flavor'
)
?
stringArg
Deprecated
(
'flavor'
)
:
null
,
trackWidgetCreation:
trackWidgetCreation
,
extraFrontEndOptions:
extraFrontEndOptions
.
isNotEmpty
...
...
@@ -1122,7 +1122,7 @@ abstract class FlutterCommand extends Command<void> {
fileSystemScheme:
fileSystemScheme
,
buildNumber:
buildNumber
,
buildName:
argParser
.
options
.
containsKey
(
'build-name'
)
?
stringArg
(
'build-name'
)
?
stringArg
Deprecated
(
'build-name'
)
:
null
,
treeShakeIcons:
treeShakeIcons
,
splitDebugInfoPath:
splitDebugInfoPath
,
...
...
@@ -1138,7 +1138,7 @@ abstract class FlutterCommand extends Command<void> {
packageConfig:
packageConfig
,
androidProjectArgs:
androidProjectArgs
,
initializeFromDill:
argParser
.
options
.
containsKey
(
FlutterOptions
.
kInitializeFromDill
)
?
stringArg
(
FlutterOptions
.
kInitializeFromDill
)
?
stringArg
Deprecated
(
FlutterOptions
.
kInitializeFromDill
)
:
null
,
assumeInitializeFromDillUpToDate:
argParser
.
options
.
containsKey
(
FlutterOptions
.
kAssumeInitializeFromDillUpToDate
)
&&
boolArg
(
FlutterOptions
.
kAssumeInitializeFromDillUpToDate
),
...
...
@@ -1522,7 +1522,14 @@ abstract class FlutterCommand extends Command<void> {
bool
boolArg
(
String
name
)
=>
argResults
?[
name
]
as
bool
?
??
false
;
/// Gets the parsed command-line option named [name] as a `String`.
String
?
stringArg
(
String
name
)
=>
argResults
?[
name
]
as
String
?;
String
?
stringArgDeprecated
(
String
name
)
=>
argResults
?[
name
]
as
String
?;
String
?
stringArg
(
String
name
)
{
if
(
argResults
==
null
||
!
argParser
.
options
.
containsKey
(
name
))
{
return
null
;
}
return
argResults
?[
name
]
as
String
?;
}
/// Gets the parsed command-line option named [name] as an `int`.
int
?
intArg
(
String
name
)
=>
argResults
?[
name
]
as
int
?;
...
...
packages/flutter_tools/test/general.shard/args_test.dart
View file @
596e9d1c
...
...
@@ -11,8 +11,22 @@ import 'package:flutter_tools/src/runner/flutter_command.dart';
import
'package:flutter_tools/src/runner/flutter_command_runner.dart'
;
import
'../src/common.dart'
;
import
'../src/context.dart'
;
import
'../src/testbed.dart'
;
class
CommandDummy
extends
FlutterCommand
{
@override
String
get
description
=>
'description'
;
@override
String
get
name
=>
'test'
;
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
return
FlutterCommandResult
.
success
();
}
}
void
main
(
)
{
test
(
'Help for command line arguments is consistently styled and complete'
,
()
=>
Testbed
().
run
(()
{
final
FlutterCommandRunner
runner
=
FlutterCommandRunner
(
verboseHelp:
true
);
...
...
@@ -22,6 +36,20 @@ void main() {
).
forEach
(
runner
.
addCommand
);
verifyCommandRunner
(
runner
);
}));
testUsingContext
(
'String? safe argResults'
,
()
async
{
final
CommandDummy
command
=
CommandDummy
();
final
FlutterCommandRunner
runner
=
FlutterCommandRunner
(
verboseHelp:
true
);
command
.
argParser
.
addOption
(
'key'
);
runner
.
addCommand
(
command
);
await
runner
.
run
(<
String
>[
'test'
,
'--key=value'
]);
expect
(
command
.
stringArg
(
'key'
),
'value'
);
expect
(
command
.
stringArg
(
'empty'
),
null
);
expect
(
command
.
stringArgDeprecated
(
'key'
),
'value'
);
expect
(()
=>
command
.
stringArgDeprecated
(
'empty'
),
throwsA
(
const
TypeMatcher
<
ArgumentError
>()));
});
}
void
verifyCommandRunner
(
CommandRunner
<
Object
>
runner
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment