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
2d3ff10d
Unverified
Commit
2d3ff10d
authored
6 years ago
by
Alexandre Ardhuin
Committed by
GitHub
6 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
apply lint prefer_void_to_null in packages/flutter_tools (#22686)
parent
c26b56cb
Changes
101
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
101 changed files
with
427 additions
and
351 deletions
+427
-351
fuchsia_asset_builder.dart
packages/flutter_tools/bin/fuchsia_asset_builder.dart
+7
-7
fuchsia_tester.dart
packages/flutter_tools/bin/fuchsia_tester.dart
+2
-2
executable.dart
packages/flutter_tools/lib/executable.dart
+1
-1
runner.dart
packages/flutter_tools/lib/runner.dart
+1
-1
android_device.dart
packages/flutter_tools/lib/src/android/android_device.dart
+2
-2
apk.dart
packages/flutter_tools/lib/src/android/apk.dart
+1
-1
gradle.dart
packages/flutter_tools/lib/src/android/gradle.dart
+3
-3
net.dart
packages/flutter_tools/lib/src/base/net.dart
+1
-1
process.dart
packages/flutter_tools/lib/src/base/process.dart
+7
-7
utils.dart
packages/flutter_tools/lib/src/base/utils.dart
+3
-3
cache.dart
packages/flutter_tools/lib/src/cache.dart
+14
-14
analyze.dart
packages/flutter_tools/lib/src/commands/analyze.dart
+5
-3
analyze_base.dart
packages/flutter_tools/lib/src/commands/analyze_base.dart
+1
-1
analyze_continuously.dart
.../flutter_tools/lib/src/commands/analyze_continuously.dart
+1
-1
analyze_once.dart
packages/flutter_tools/lib/src/commands/analyze_once.dart
+2
-2
attach.dart
packages/flutter_tools/lib/src/commands/attach.dart
+3
-2
build.dart
packages/flutter_tools/lib/src/commands/build.dart
+3
-2
build_aot.dart
packages/flutter_tools/lib/src/commands/build_aot.dart
+4
-3
build_apk.dart
packages/flutter_tools/lib/src/commands/build_apk.dart
+3
-1
build_bundle.dart
packages/flutter_tools/lib/src/commands/build_bundle.dart
+3
-2
build_flx.dart
packages/flutter_tools/lib/src/commands/build_flx.dart
+4
-1
build_ios.dart
packages/flutter_tools/lib/src/commands/build_ios.dart
+4
-1
channel.dart
packages/flutter_tools/lib/src/commands/channel.dart
+9
-7
clean.dart
packages/flutter_tools/lib/src/commands/clean.dart
+4
-2
config.dart
packages/flutter_tools/lib/src/commands/config.dart
+8
-4
create.dart
packages/flutter_tools/lib/src/commands/create.dart
+3
-1
daemon.dart
packages/flutter_tools/lib/src/commands/daemon.dart
+17
-16
devices.dart
packages/flutter_tools/lib/src/commands/devices.dart
+3
-1
drive.dart
packages/flutter_tools/lib/src/commands/drive.dart
+6
-3
emulators.dart
packages/flutter_tools/lib/src/commands/emulators.dart
+4
-2
format.dart
packages/flutter_tools/lib/src/commands/format.dart
+3
-1
fuchsia_reload.dart
packages/flutter_tools/lib/src/commands/fuchsia_reload.dart
+8
-6
ide_config.dart
packages/flutter_tools/lib/src/commands/ide_config.dart
+4
-2
inject_plugins.dart
packages/flutter_tools/lib/src/commands/inject_plugins.dart
+3
-1
install.dart
packages/flutter_tools/lib/src/commands/install.dart
+4
-2
logs.dart
packages/flutter_tools/lib/src/commands/logs.dart
+3
-1
make_host_app_editable.dart
...lutter_tools/lib/src/commands/make_host_app_editable.dart
+10
-5
packages.dart
packages/flutter_tools/lib/src/commands/packages.dart
+12
-4
precache.dart
packages/flutter_tools/lib/src/commands/precache.dart
+3
-1
run.dart
packages/flutter_tools/lib/src/commands/run.dart
+1
-1
screenshot.dart
packages/flutter_tools/lib/src/commands/screenshot.dart
+12
-7
shell_completion.dart
...ages/flutter_tools/lib/src/commands/shell_completion.dart
+4
-2
stop.dart
packages/flutter_tools/lib/src/commands/stop.dart
+4
-2
test.dart
packages/flutter_tools/lib/src/commands/test.dart
+1
-1
trace.dart
packages/flutter_tools/lib/src/commands/trace.dart
+5
-3
update_packages.dart
packages/flutter_tools/lib/src/commands/update_packages.dart
+7
-5
upgrade.dart
packages/flutter_tools/lib/src/commands/upgrade.dart
+3
-1
crash_reporting.dart
packages/flutter_tools/lib/src/crash_reporting.dart
+1
-1
analysis.dart
packages/flutter_tools/lib/src/dart/analysis.dart
+1
-1
pub.dart
packages/flutter_tools/lib/src/dart/pub.dart
+4
-4
devfs.dart
packages/flutter_tools/lib/src/devfs.dart
+8
-8
device.dart
packages/flutter_tools/lib/src/device.dart
+3
-3
disabled_usage.dart
packages/flutter_tools/lib/src/disabled_usage.dart
+1
-1
doctor.dart
packages/flutter_tools/lib/src/doctor.dart
+1
-1
fuchsia_device.dart
packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
+1
-1
cocoapods.dart
packages/flutter_tools/lib/src/ios/cocoapods.dart
+1
-1
devices.dart
packages/flutter_tools/lib/src/ios/devices.dart
+3
-3
mac.dart
packages/flutter_tools/lib/src/ios/mac.dart
+3
-3
simulators.dart
packages/flutter_tools/lib/src/ios/simulators.dart
+3
-3
protocol_discovery.dart
packages/flutter_tools/lib/src/protocol_discovery.dart
+2
-2
resident_runner.dart
packages/flutter_tools/lib/src/resident_runner.dart
+47
-47
run_cold.dart
packages/flutter_tools/lib/src/run_cold.dart
+4
-4
run_hot.dart
packages/flutter_tools/lib/src/run_hot.dart
+9
-9
flutter_command.dart
packages/flutter_tools/lib/src/runner/flutter_command.dart
+4
-4
flutter_command_runner.dart
.../flutter_tools/lib/src/runner/flutter_command_runner.dart
+5
-5
services.dart
packages/flutter_tools/lib/src/services.dart
+1
-1
coverage_collector.dart
packages/flutter_tools/lib/src/test/coverage_collector.dart
+1
-1
flutter_platform.dart
packages/flutter_tools/lib/src/test/flutter_platform.dart
+1
-1
flutter_tester.dart
packages/flutter_tools/lib/src/tester/flutter_tester.dart
+1
-1
tracing.dart
packages/flutter_tools/lib/src/tracing.dart
+3
-3
usage.dart
packages/flutter_tools/lib/src/usage.dart
+1
-1
version.dart
packages/flutter_tools/lib/src/version.dart
+6
-6
vmservice.dart
packages/flutter_tools/lib/src/vmservice.dart
+12
-12
vmservice_record_replay.dart
packages/flutter_tools/lib/src/vmservice_record_replay.dart
+1
-1
analytics_test.dart
packages/flutter_tools/test/analytics_test.dart
+4
-4
asset_bundle_package_fonts_test.dart
...s/flutter_tools/test/asset_bundle_package_fonts_test.dart
+1
-1
asset_bundle_package_test.dart
packages/flutter_tools/test/asset_bundle_package_test.dart
+1
-1
flags_test.dart
packages/flutter_tools/test/base/flags_test.dart
+2
-2
channel_test.dart
packages/flutter_tools/test/channel_test.dart
+4
-4
analyze_once_test.dart
packages/flutter_tools/test/commands/analyze_once_test.dart
+1
-1
create_test.dart
packages/flutter_tools/test/commands/create_test.dart
+17
-17
daemon_test.dart
packages/flutter_tools/test/commands/daemon_test.dart
+2
-2
format_test.dart
packages/flutter_tools/test/commands/format_test.dart
+3
-3
ide_config_test.dart
packages/flutter_tools/test/commands/ide_config_test.dart
+2
-2
packages_test.dart
packages/flutter_tools/test/commands/packages_test.dart
+6
-6
test_test.dart
packages/flutter_tools/test/commands/test_test.dart
+3
-3
compile_test.dart
packages/flutter_tools/test/compile_test.dart
+1
-1
crash_reporting_test.dart
packages/flutter_tools/test/crash_reporting_test.dart
+3
-1
pub_get_test.dart
packages/flutter_tools/test/dart/pub_get_test.dart
+4
-4
devfs_test.dart
packages/flutter_tools/test/devfs_test.dart
+4
-4
device_test.dart
packages/flutter_tools/test/device_test.dart
+1
-1
emulator_test.dart
packages/flutter_tools/test/emulator_test.dart
+1
-1
project_test.dart
packages/flutter_tools/test/project_test.dart
+3
-3
protocol_discovery_test.dart
packages/flutter_tools/test/protocol_discovery_test.dart
+1
-1
resident_runner_test.dart
packages/flutter_tools/test/resident_runner_test.dart
+3
-3
flutter_command_test.dart
packages/flutter_tools/test/runner/flutter_command_test.dart
+1
-1
common.dart
packages/flutter_tools/test/src/common.dart
+2
-2
context.dart
packages/flutter_tools/test/src/context.dart
+1
-1
mocks.dart
packages/flutter_tools/test/src/mocks.dart
+7
-7
utils_test.dart
packages/flutter_tools/test/utils_test.dart
+3
-3
daemon_client.dart
packages/flutter_tools/tool/daemon_client.dart
+2
-2
No files found.
packages/flutter_tools/bin/fuchsia_asset_builder.dart
View file @
2d3ff10d
...
...
@@ -30,20 +30,20 @@ const List<String> _kRequiredOptions = <String>[
_kOptionComponentName
,
];
Future
<
Null
>
main
(
List
<
String
>
args
)
{
return
runInContext
<
Null
>(()
=>
run
(
args
),
overrides:
<
Type
,
Generator
>{
Future
<
void
>
main
(
List
<
String
>
args
)
{
return
runInContext
<
void
>(()
=>
run
(
args
),
overrides:
<
Type
,
Generator
>{
Usage:
()
=>
DisabledUsage
(),
});
}
Future
<
Null
>
writeFile
(
libfs
.
File
outputFile
,
DevFSContent
content
)
async
{
Future
<
void
>
writeFile
(
libfs
.
File
outputFile
,
DevFSContent
content
)
async
{
outputFile
.
createSync
(
recursive:
true
);
final
List
<
int
>
data
=
await
content
.
contentsAsBytes
();
outputFile
.
writeAsBytesSync
(
data
);
return
null
;
}
Future
<
Null
>
run
(
List
<
String
>
args
)
async
{
Future
<
void
>
run
(
List
<
String
>
args
)
async
{
final
ArgParser
parser
=
ArgParser
()
..
addOption
(
_kOptionPackages
,
help:
'The .packages file'
)
..
addOption
(
_kOptionAsset
,
...
...
@@ -72,18 +72,18 @@ Future<Null> run(List<String> args) async {
exit
(
1
);
}
final
List
<
Future
<
Null
>>
calls
=
<
Future
<
Null
>>[];
final
List
<
Future
<
void
>>
calls
=
<
Future
<
void
>>[];
assets
.
entries
.
forEach
((
String
fileName
,
DevFSContent
content
)
{
final
libfs
.
File
outputFile
=
libfs
.
fs
.
file
(
libfs
.
fs
.
path
.
join
(
assetDir
,
fileName
));
calls
.
add
(
writeFile
(
outputFile
,
content
));
});
await
Future
.
wait
<
Null
>(
calls
);
await
Future
.
wait
<
void
>(
calls
);
final
String
outputMan
=
argResults
[
_kOptionAssetManifestOut
];
await
writeFuchsiaManifest
(
assets
,
argResults
[
_kOptionAsset
],
outputMan
,
argResults
[
_kOptionComponentName
]);
}
Future
<
Null
>
writeFuchsiaManifest
(
AssetBundle
assets
,
String
outputBase
,
String
fileDest
,
String
componentName
)
async
{
Future
<
void
>
writeFuchsiaManifest
(
AssetBundle
assets
,
String
outputBase
,
String
fileDest
,
String
componentName
)
async
{
final
libfs
.
File
destFile
=
libfs
.
fs
.
file
(
fileDest
);
await
destFile
.
create
(
recursive:
true
);
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/bin/fuchsia_tester.dart
View file @
2d3ff10d
...
...
@@ -43,12 +43,12 @@ const String _kOptionCoverage = 'coverage';
const
String
_kOptionCoveragePath
=
'coverage-path'
;
void
main
(
List
<
String
>
args
)
{
runInContext
<
Null
>(()
=>
run
(
args
),
overrides:
<
Type
,
Generator
>{
runInContext
<
void
>(()
=>
run
(
args
),
overrides:
<
Type
,
Generator
>{
Usage:
()
=>
DisabledUsage
(),
});
}
Future
<
Null
>
run
(
List
<
String
>
args
)
async
{
Future
<
void
>
run
(
List
<
String
>
args
)
async
{
final
ArgParser
parser
=
ArgParser
()
..
addOption
(
_kOptionPackages
,
help:
'The .packages file'
)
..
addOption
(
_kOptionShell
,
help:
'The Flutter shell binary'
)
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/executable.dart
View file @
2d3ff10d
...
...
@@ -39,7 +39,7 @@ import 'src/runner/flutter_command.dart';
/// Main entry point for commands.
///
/// This function is intended to be used from the `flutter` command line tool.
Future
<
Null
>
main
(
List
<
String
>
args
)
async
{
Future
<
void
>
main
(
List
<
String
>
args
)
async
{
final
bool
verbose
=
args
.
contains
(
'-v'
)
||
args
.
contains
(
'--verbose'
);
final
bool
doctor
=
(
args
.
isNotEmpty
&&
args
.
first
==
'doctor'
)
||
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/runner.dart
View file @
2d3ff10d
...
...
@@ -211,7 +211,7 @@ Future<int> _exit(int code) async {
// Run shutdown hooks before flushing logs
await
runShutdownHooks
();
final
Completer
<
Null
>
completer
=
Completer
<
Null
>();
final
Completer
<
void
>
completer
=
Completer
<
void
>();
// Give the task / timer queue one cycle through before we hard exit.
Timer
.
run
(()
{
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/android/android_device.dart
View file @
2d3ff10d
...
...
@@ -676,7 +676,7 @@ class _AdbLogReader extends DeviceLogReader {
_timeOrigin
=
_adbTimestampToDateTime
(
lastTimestamp
);
else
_timeOrigin
=
null
;
runCommand
(
device
.
adbCommandForDevice
(
args
)).
then
<
Null
>((
Process
process
)
{
runCommand
(
device
.
adbCommandForDevice
(
args
)).
then
<
void
>((
Process
process
)
{
_process
=
process
;
const
Utf8Decoder
decoder
=
Utf8Decoder
(
allowMalformed:
true
);
_process
.
stdout
.
transform
<
String
>(
decoder
).
transform
<
String
>(
const
LineSplitter
()).
listen
(
_onLine
);
...
...
@@ -868,7 +868,7 @@ class _AndroidDevicePortForwarder extends DevicePortForwarder {
}
@override
Future
<
Null
>
unforward
(
ForwardedPort
forwardedPort
)
async
{
Future
<
void
>
unforward
(
ForwardedPort
forwardedPort
)
async
{
await
runCheckedAsync
(
device
.
adbCommandForDevice
(
<
String
>[
'forward'
,
'--remove'
,
'tcp:
${forwardedPort.hostPort}
'
]
));
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/android/apk.dart
View file @
2d3ff10d
...
...
@@ -14,7 +14,7 @@ import '../project.dart';
import
'android_sdk.dart'
;
import
'gradle.dart'
;
Future
<
Null
>
buildApk
({
Future
<
void
>
buildApk
({
@required
FlutterProject
project
,
@required
String
target
,
BuildInfo
buildInfo
=
BuildInfo
.
debug
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/android/gradle.dart
View file @
2d3ff10d
...
...
@@ -272,7 +272,7 @@ void _exitIfNoAndroidSdk() {
}
}
Future
<
Null
>
buildGradleProject
({
Future
<
void
>
buildGradleProject
({
@required
FlutterProject
project
,
@required
BuildInfo
buildInfo
,
@required
String
target
,
...
...
@@ -301,7 +301,7 @@ Future<Null> buildGradleProject({
}
}
Future
<
Null
>
_buildGradleProjectV1
(
FlutterProject
project
,
String
gradle
)
async
{
Future
<
void
>
_buildGradleProjectV1
(
FlutterProject
project
,
String
gradle
)
async
{
// Run 'gradlew build'.
final
Status
status
=
logger
.
startProgress
(
"Running 'gradlew build'..."
,
...
...
@@ -322,7 +322,7 @@ Future<Null> _buildGradleProjectV1(FlutterProject project, String gradle) async
printStatus
(
'Built
${fs.path.relative(project.android.gradleAppOutV1File.path)}
.'
);
}
Future
<
Null
>
_buildGradleProjectV2
(
Future
<
void
>
_buildGradleProjectV2
(
FlutterProject
flutterProject
,
String
gradle
,
BuildInfo
buildInfo
,
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/base/net.dart
View file @
2d3ff10d
...
...
@@ -23,7 +23,7 @@ Future<List<int>> fetchUrl(Uri url) async {
if
(
result
!=
null
)
return
result
;
printStatus
(
'Download failed -- attempting retry
$attempts
in
$duration
second
${ duration == 1 ? "" : "s"}
...'
);
await
Future
<
Null
>.
delayed
(
Duration
(
seconds:
duration
));
await
Future
<
void
>.
delayed
(
Duration
(
seconds:
duration
));
if
(
duration
<
64
)
duration
*=
2
;
}
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/base/process.dart
View file @
2d3ff10d
...
...
@@ -74,7 +74,7 @@ void addShutdownHook(
/// hooks within a given stage will be started in parallel and will be
/// guaranteed to run to completion before shutdown hooks in the next stage are
/// started.
Future
<
Null
>
runShutdownHooks
()
async
{
Future
<
void
>
runShutdownHooks
()
async
{
printTrace
(
'Running shutdown hooks'
);
_shutdownHooksRunning
=
true
;
try
{
...
...
@@ -164,12 +164,12 @@ Future<int> runCommandAndStreamOutput(List<String> cmd, {
// Wait for stdout to be fully processed
// because process.exitCode may complete first causing flaky tests.
await
waitGroup
<
Null
>(<
Future
<
Null
>>[
stdoutSubscription
.
asFuture
<
Null
>(),
stderrSubscription
.
asFuture
<
Null
>(),
await
waitGroup
<
void
>(<
Future
<
void
>>[
stdoutSubscription
.
asFuture
<
void
>(),
stderrSubscription
.
asFuture
<
void
>(),
]);
await
waitGroup
<
Null
>(<
Future
<
Null
>>[
await
waitGroup
<
void
>(<
Future
<
void
>>[
stdoutSubscription
.
cancel
(),
stderrSubscription
.
cancel
(),
]);
...
...
@@ -203,9 +203,9 @@ Future<int> runInteractively(List<String> command, {
return
await
process
.
exitCode
;
}
Future
<
Null
>
runAndKill
(
List
<
String
>
cmd
,
Duration
timeout
)
{
Future
<
void
>
runAndKill
(
List
<
String
>
cmd
,
Duration
timeout
)
{
final
Future
<
Process
>
proc
=
runDetached
(
cmd
);
return
Future
<
Null
>.
delayed
(
timeout
,
()
async
{
return
Future
<
void
>.
delayed
(
timeout
,
()
async
{
printTrace
(
'Intentionally killing
${cmd[0]}
'
);
processManager
.
killPid
((
await
proc
).
pid
);
});
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/base/utils.dart
View file @
2d3ff10d
...
...
@@ -251,14 +251,14 @@ Map<String, dynamic> castStringKeyedMap(dynamic untyped) {
Clock
get
clock
=>
context
[
Clock
];
typedef
AsyncCallback
=
Future
<
Null
>
Function
();
typedef
AsyncCallback
=
Future
<
void
>
Function
();
/// A [Timer] inspired class that:
/// - has a different initial value for the first callback delay
/// - waits for a callback to be complete before it starts the next timer
class
Poller
{
Poller
(
this
.
callback
,
this
.
pollingInterval
,
{
this
.
initialDelay
=
Duration
.
zero
})
{
Future
<
Null
>.
delayed
(
initialDelay
,
_handleCallback
);
Future
<
void
>.
delayed
(
initialDelay
,
_handleCallback
);
}
final
AsyncCallback
callback
;
...
...
@@ -268,7 +268,7 @@ class Poller {
bool
_cancelled
=
false
;
Timer
_timer
;
Future
<
Null
>
_handleCallback
()
async
{
Future
<
void
>
_handleCallback
()
async
{
if
(
_cancelled
)
return
;
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/cache.dart
View file @
2d3ff10d
...
...
@@ -70,7 +70,7 @@ class Cache {
/// Normally the lock will be held until the process exits (this uses normal
/// POSIX flock semantics). Long-lived commands should release the lock by
/// calling [Cache.releaseLockEarly] once they are no longer touching the cache.
static
Future
<
Null
>
lock
()
async
{
static
Future
<
void
>
lock
()
async
{
if
(!
_lockEnabled
)
return
null
;
assert
(
_lock
==
null
);
...
...
@@ -87,7 +87,7 @@ class Cache {
printStatus
(
'Waiting for another flutter command to release the startup lock...'
);
printed
=
true
;
}
await
Future
<
Null
>.
delayed
(
const
Duration
(
milliseconds:
50
));
await
Future
<
void
>.
delayed
(
const
Duration
(
milliseconds:
50
));
}
}
}
...
...
@@ -199,7 +199,7 @@ class Cache {
return
cachedFile
.
path
;
}
Future
<
Null
>
updateAll
()
async
{
Future
<
void
>
updateAll
()
async
{
if
(!
_lockEnabled
)
return
null
;
try
{
...
...
@@ -245,7 +245,7 @@ abstract class CachedArtifact {
return
isUpToDateInner
();
}
Future
<
Null
>
update
()
async
{
Future
<
void
>
update
()
async
{
if
(
location
.
existsSync
())
location
.
deleteSync
(
recursive:
true
);
location
.
createSync
(
recursive:
true
);
...
...
@@ -272,7 +272,7 @@ abstract class CachedArtifact {
bool
isUpToDateInner
()
=>
true
;
/// Template method to perform artifact update.
Future
<
Null
>
updateInner
();
Future
<
void
>
updateInner
();
String
get
_storageBaseUrl
{
final
String
overrideUrl
=
platform
.
environment
[
'FLUTTER_STORAGE_BASE_URL'
];
...
...
@@ -285,7 +285,7 @@ abstract class CachedArtifact {
Uri
_toStorageUri
(
String
path
)
=>
Uri
.
parse
(
'
$_storageBaseUrl
/
$path
'
);
/// Download an archive from the given [url] and unzip it to [location].
Future
<
Null
>
_downloadArchive
(
String
message
,
Uri
url
,
Directory
location
,
bool
verifier
(
File
f
),
void
extractor
(
File
f
,
Directory
d
))
{
Future
<
void
>
_downloadArchive
(
String
message
,
Uri
url
,
Directory
location
,
bool
verifier
(
File
f
),
void
extractor
(
File
f
,
Directory
d
))
{
return
_withDownloadFile
(
'
${flattenNameSubdirs(url)}
'
,
(
File
tempFile
)
async
{
if
(!
verifier
(
tempFile
))
{
final
Status
status
=
logger
.
startProgress
(
message
,
expectSlowOperation:
true
);
...
...
@@ -305,18 +305,18 @@ abstract class CachedArtifact {
}
/// Download a zip archive from the given [url] and unzip it to [location].
Future
<
Null
>
_downloadZipArchive
(
String
message
,
Uri
url
,
Directory
location
)
{
Future
<
void
>
_downloadZipArchive
(
String
message
,
Uri
url
,
Directory
location
)
{
return
_downloadArchive
(
message
,
url
,
location
,
os
.
verifyZip
,
os
.
unzip
);
}
/// Download a gzipped tarball from the given [url] and unpack it to [location].
Future
<
Null
>
_downloadZippedTarball
(
String
message
,
Uri
url
,
Directory
location
)
{
Future
<
void
>
_downloadZippedTarball
(
String
message
,
Uri
url
,
Directory
location
)
{
return
_downloadArchive
(
message
,
url
,
location
,
os
.
verifyGzip
,
os
.
unpack
);
}
/// Create a temporary file and invoke [onTemporaryFile] with the file as
/// argument, then add the temporary file to the [_downloadedFiles].
Future
<
Null
>
_withDownloadFile
(
String
name
,
Future
<
Null
>
onTemporaryFile
(
File
file
))
async
{
Future
<
void
>
_withDownloadFile
(
String
name
,
Future
<
void
>
onTemporaryFile
(
File
file
))
async
{
final
File
tempFile
=
fs
.
file
(
fs
.
path
.
join
(
cache
.
getDownloadDir
().
path
,
name
));
_downloadedFiles
.
add
(
tempFile
);
await
onTemporaryFile
(
tempFile
);
...
...
@@ -340,7 +340,7 @@ class MaterialFonts extends CachedArtifact {
MaterialFonts
(
Cache
cache
):
super
(
'material_fonts'
,
cache
);
@override
Future
<
Null
>
updateInner
()
{
Future
<
void
>
updateInner
()
{
final
Uri
archiveUri
=
_toStorageUri
(
version
);
return
_downloadZipArchive
(
'Downloading Material fonts...'
,
archiveUri
,
location
);
}
...
...
@@ -470,7 +470,7 @@ class FlutterEngine extends CachedArtifact {
}
@override
Future
<
Null
>
updateInner
()
async
{
Future
<
void
>
updateInner
()
async
{
final
String
url
=
'
$_storageBaseUrl
/flutter_infra/flutter/
$version
/'
;
final
Directory
pkgDir
=
cache
.
getCacheDir
(
'pkg'
);
...
...
@@ -521,9 +521,9 @@ class GradleWrapper extends CachedArtifact {
GradleWrapper
(
Cache
cache
):
super
(
'gradle_wrapper'
,
cache
);
@override
Future
<
Null
>
updateInner
()
{
Future
<
void
>
updateInner
()
{
final
Uri
archiveUri
=
_toStorageUri
(
version
);
return
_downloadZippedTarball
(
'Downloading Gradle Wrapper...'
,
archiveUri
,
location
).
then
<
Null
>((
_
)
{
return
_downloadZippedTarball
(
'Downloading Gradle Wrapper...'
,
archiveUri
,
location
).
then
<
void
>((
_
)
{
// Delete property file, allowing templates to provide it.
fs
.
file
(
fs
.
path
.
join
(
location
.
path
,
'gradle'
,
'wrapper'
,
'gradle-wrapper.properties'
)).
deleteSync
();
// Remove NOTICE file. Should not be part of the template.
...
...
@@ -565,7 +565,7 @@ String flattenNameSubdirs(Uri url) {
}
/// Download a file from the given [url] and write it to [location].
Future
<
Null
>
_downloadFile
(
Uri
url
,
File
location
)
async
{
Future
<
void
>
_downloadFile
(
Uri
url
,
File
location
)
async
{
_ensureExists
(
location
.
parent
);
final
List
<
int
>
fileBytes
=
await
fetchUrl
(
url
);
location
.
writeAsBytesSync
(
fileBytes
,
flush:
true
);
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/analyze.dart
View file @
2d3ff10d
...
...
@@ -80,20 +80,22 @@ class AnalyzeCommand extends FlutterCommand {
}
@override
Future
<
Null
>
runCommand
()
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
if
(
argResults
[
'watch'
])
{
return
AnalyzeContinuously
(
await
AnalyzeContinuously
(
argResults
,
runner
.
getRepoRoots
(),
runner
.
getRepoPackages
(),
).
analyze
();
return
null
;
}
else
{
return
AnalyzeOnce
(
await
AnalyzeOnce
(
argResults
,
runner
.
getRepoRoots
(),
runner
.
getRepoPackages
(),
workingDirectory:
workingDirectory
,
).
analyze
();
return
null
;
}
}
}
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/analyze_base.dart
View file @
2d3ff10d
...
...
@@ -21,7 +21,7 @@ abstract class AnalyzeBase {
final
ArgResults
argResults
;
/// Called by [AnalyzeCommand] to start the analysis process.
Future
<
Null
>
analyze
();
Future
<
void
>
analyze
();
void
dumpErrors
(
Iterable
<
String
>
errors
)
{
if
(
argResults
[
'write'
]
!=
null
)
{
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/analyze_continuously.dart
View file @
2d3ff10d
...
...
@@ -33,7 +33,7 @@ class AnalyzeContinuously extends AnalyzeBase {
Status
analysisStatus
;
@override
Future
<
Null
>
analyze
()
async
{
Future
<
void
>
analyze
()
async
{
List
<
String
>
directories
;
if
(
argResults
[
'flutter-repo'
])
{
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/analyze_once.dart
View file @
2d3ff10d
...
...
@@ -33,7 +33,7 @@ class AnalyzeOnce extends AnalyzeBase {
final
Directory
workingDirectory
;
@override
Future
<
Null
>
analyze
()
async
{
Future
<
void
>
analyze
()
async
{
final
String
currentDirectory
=
(
workingDirectory
??
fs
.
currentDirectory
).
path
;
...
...
@@ -68,7 +68,7 @@ class AnalyzeOnce extends AnalyzeBase {
throwToolExit
(
'Nothing to analyze.'
,
exitCode:
0
);
// analyze all
final
Completer
<
Null
>
analysisCompleter
=
Completer
<
Null
>();
final
Completer
<
void
>
analysisCompleter
=
Completer
<
void
>();
final
List
<
AnalysisError
>
errors
=
<
AnalysisError
>[];
final
String
sdkPath
=
argResults
[
'dart-sdk'
]
??
sdk
.
dartSdkPath
;
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/attach.dart
View file @
2d3ff10d
...
...
@@ -76,7 +76,7 @@ class AttachCommand extends FlutterCommand {
}
@override
Future
<
Null
>
validateCommand
()
async
{
Future
<
void
>
validateCommand
()
async
{
await
super
.
validateCommand
();
if
(
await
findTargetDevice
()
==
null
)
throwToolExit
(
null
);
...
...
@@ -84,7 +84,7 @@ class AttachCommand extends FlutterCommand {
}
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Cache
.
releaseLockEarly
();
await
_validateArguments
();
...
...
@@ -152,6 +152,7 @@ class AttachCommand extends FlutterCommand {
final
List
<
ForwardedPort
>
ports
=
device
.
portForwarder
.
forwardedPorts
.
toList
();
ports
.
forEach
(
device
.
portForwarder
.
unforward
);
}
return
null
;
}
Future
<
void
>
_validateArguments
()
async
{}
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/build.dart
View file @
2d3ff10d
...
...
@@ -32,7 +32,7 @@ class BuildCommand extends FlutterCommand {
final
String
description
=
'Flutter build commands.'
;
@override
Future
<
Null
>
runCommand
()
async
{
}
Future
<
FlutterCommandResult
>
runCommand
()
async
=>
null
;
}
abstract
class
BuildSubCommand
extends
FlutterCommand
{
...
...
@@ -42,7 +42,7 @@ abstract class BuildSubCommand extends FlutterCommand {
@override
@mustCallSuper
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
if
(
isRunningOnBot
)
{
final
File
dotPackages
=
fs
.
file
(
'.packages'
);
printStatus
(
'Contents of .packages:'
);
...
...
@@ -58,5 +58,6 @@ abstract class BuildSubCommand extends FlutterCommand {
else
printError
(
'File not found:
${pubspecLock.absolute.path}
'
);
}
return
null
;
}
}
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/build_aot.dart
View file @
2d3ff10d
...
...
@@ -56,7 +56,7 @@ class BuildAotCommand extends BuildSubCommand {
final
String
description
=
"Build an ahead-of-time compiled snapshot of your app's Dart code."
;
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
super
.
runCommand
();
final
String
targetPlatform
=
argResults
[
'target-platform'
];
...
...
@@ -89,7 +89,7 @@ class BuildAotCommand extends BuildSubCommand {
);
if
(
mainPath
==
null
)
{
throwToolExit
(
'Compiler terminated unexpectedly.'
);
return
;
return
null
;
}
// Build AOT snapshot.
...
...
@@ -152,7 +152,7 @@ class BuildAotCommand extends BuildSubCommand {
// Catch the String exceptions thrown from the `runCheckedSync` methods below.
status
?.
cancel
();
printError
(
error
);
return
;
return
null
;
}
status
?.
stop
();
...
...
@@ -165,5 +165,6 @@ class BuildAotCommand extends BuildSubCommand {
}
else
{
printStatus
(
builtMessage
);
}
return
null
;
}
}
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/build_apk.dart
View file @
2d3ff10d
...
...
@@ -6,6 +6,7 @@ import 'dart:async';
import
'../android/apk.dart'
;
import
'../project.dart'
;
import
'../runner/flutter_command.dart'
show
FlutterCommandResult
;
import
'build.dart'
;
class
BuildApkCommand
extends
BuildSubCommand
{
...
...
@@ -38,12 +39,13 @@ class BuildApkCommand extends BuildSubCommand {
'suitable for deploying to app stores.'
;
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
super
.
runCommand
();
await
buildApk
(
project:
await
FlutterProject
.
current
(),
target:
targetFile
,
buildInfo:
getBuildInfo
(),
);
return
null
;
}
}
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/build_bundle.dart
View file @
2d3ff10d
...
...
@@ -7,7 +7,7 @@ import 'dart:async';
import
'../base/common.dart'
;
import
'../build_info.dart'
;
import
'../bundle.dart'
;
import
'../runner/flutter_command.dart'
show
FlutterOptions
;
import
'../runner/flutter_command.dart'
show
FlutterOptions
,
FlutterCommandResult
;
import
'build.dart'
;
class
BuildBundleCommand
extends
BuildSubCommand
{
...
...
@@ -78,7 +78,7 @@ class BuildBundleCommand extends BuildSubCommand {
' iOS runtimes.'
;
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
super
.
runCommand
();
final
String
targetPlatform
=
argResults
[
'target-platform'
];
...
...
@@ -108,5 +108,6 @@ class BuildBundleCommand extends BuildSubCommand {
fileSystemScheme:
argResults
[
'filesystem-scheme'
],
fileSystemRoots:
argResults
[
'filesystem-root'
],
);
return
null
;
}
}
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/build_flx.dart
View file @
2d3ff10d
...
...
@@ -5,6 +5,7 @@
import
'dart:async'
;
import
'../globals.dart'
;
import
'../runner/flutter_command.dart'
show
FlutterCommandResult
;
import
'build.dart'
;
class
BuildFlxCommand
extends
BuildSubCommand
{
...
...
@@ -18,11 +19,13 @@ class BuildFlxCommand extends BuildSubCommand {
final
String
usageFooter
=
'FLX archives are deprecated.'
;
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
super
.
runCommand
();
printError
(
"'build flx' is no longer supported. Instead, use 'build "
"bundle' to build and assemble the application code and resources "
'for your app.'
);
return
null
;
}
}
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/build_ios.dart
View file @
2d3ff10d
...
...
@@ -10,6 +10,7 @@ import '../base/utils.dart';
import
'../build_info.dart'
;
import
'../globals.dart'
;
import
'../ios/mac.dart'
;
import
'../runner/flutter_command.dart'
show
FlutterCommandResult
;
import
'build.dart'
;
class
BuildIOSCommand
extends
BuildSubCommand
{
...
...
@@ -48,7 +49,7 @@ class BuildIOSCommand extends BuildSubCommand {
final
String
description
=
'Build an iOS application bundle (Mac OS X host only).'
;
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
final
bool
forSimulator
=
argResults
[
'simulator'
];
defaultBuildMode
=
forSimulator
?
BuildMode
.
debug
:
BuildMode
.
release
;
...
...
@@ -90,5 +91,7 @@ class BuildIOSCommand extends BuildSubCommand {
if
(
result
.
output
!=
null
)
printStatus
(
'Built
${result.output}
.'
);
return
null
;
}
}
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/channel.dart
View file @
2d3ff10d
...
...
@@ -32,18 +32,20 @@ class ChannelCommand extends FlutterCommand {
String
get
invocation
=>
'
${runner.executableName}
$name
[<channel-name>]'
;
@override
Future
<
Null
>
runCommand
()
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
switch
(
argResults
.
rest
.
length
)
{
case
0
:
return
_listChannels
(
showAll:
argResults
[
'all'
]);
await
_listChannels
(
showAll:
argResults
[
'all'
]);
return
null
;
case
1
:
return
_switchChannel
(
argResults
.
rest
[
0
]);
await
_switchChannel
(
argResults
.
rest
[
0
]);
return
null
;
default
:
throw
ToolExit
(
'Too many arguments.
\n
$usage
'
);
}
}
Future
<
Null
>
_listChannels
({
bool
showAll
})
async
{
Future
<
void
>
_listChannels
({
bool
showAll
})
async
{
// Beware: currentBranch could contain PII. See getBranchName().
final
String
currentChannel
=
FlutterVersion
.
instance
.
channel
;
final
String
currentBranch
=
FlutterVersion
.
instance
.
getBranchName
();
...
...
@@ -76,7 +78,7 @@ class ChannelCommand extends FlutterCommand {
throwToolExit
(
'List channels failed:
$result
'
,
exitCode:
result
);
}
Future
<
Null
>
_switchChannel
(
String
branchName
)
{
Future
<
void
>
_switchChannel
(
String
branchName
)
{
printStatus
(
"Switching to flutter channel '
$branchName
'..."
);
if
(
FlutterVersion
.
obsoleteBranches
.
containsKey
(
branchName
))
{
final
String
alternative
=
FlutterVersion
.
obsoleteBranches
[
branchName
];
...
...
@@ -87,7 +89,7 @@ class ChannelCommand extends FlutterCommand {
return
_checkout
(
branchName
);
}
static
Future
<
Null
>
upgradeChannel
()
async
{
static
Future
<
void
>
upgradeChannel
()
async
{
final
String
channel
=
FlutterVersion
.
instance
.
channel
;
if
(
FlutterVersion
.
obsoleteBranches
.
containsKey
(
channel
))
{
final
String
alternative
=
FlutterVersion
.
obsoleteBranches
[
channel
];
...
...
@@ -96,7 +98,7 @@ class ChannelCommand extends FlutterCommand {
}
}
static
Future
<
Null
>
_checkout
(
String
branchName
)
async
{
static
Future
<
void
>
_checkout
(
String
branchName
)
async
{
// Get latest refs from upstream.
int
result
=
await
runCommandAndStreamOutput
(
<
String
>[
'git'
,
'fetch'
],
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/clean.dart
View file @
2d3ff10d
...
...
@@ -22,17 +22,19 @@ class CleanCommand extends FlutterCommand {
final
String
description
=
'Delete the build/ directory.'
;
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
final
Directory
buildDir
=
fs
.
directory
(
getBuildDirectory
());
printStatus
(
"Deleting '
${buildDir.path}${fs.path.separator}
'."
);
if
(!
buildDir
.
existsSync
())
return
;
return
null
;
try
{
buildDir
.
deleteSync
(
recursive:
true
);
}
catch
(
error
)
{
throwToolExit
(
error
.
toString
());
}
return
null
;
}
}
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/config.dart
View file @
2d3ff10d
...
...
@@ -62,9 +62,11 @@ class ConfigCommand extends FlutterCommand {
Future
<
String
>
get
usagePath
=>
null
;
@override
Future
<
Null
>
runCommand
()
async
{
if
(
argResults
[
'machine'
])
return
handleMachine
();
Future
<
FlutterCommandResult
>
runCommand
()
async
{
if
(
argResults
[
'machine'
])
{
await
handleMachine
();
return
null
;
}
if
(
argResults
.
wasParsed
(
'analytics'
))
{
final
bool
value
=
argResults
[
'analytics'
];
...
...
@@ -86,9 +88,11 @@ class ConfigCommand extends FlutterCommand {
if
(
argResults
.
arguments
.
isEmpty
)
printStatus
(
usage
);
return
null
;
}
Future
<
Null
>
handleMachine
()
async
{
Future
<
void
>
handleMachine
()
async
{
// Get all the current values.
final
Map
<
String
,
dynamic
>
results
=
<
String
,
dynamic
>{};
for
(
String
key
in
config
.
keys
)
{
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/create.dart
View file @
2d3ff10d
...
...
@@ -171,7 +171,7 @@ class CreateCommand extends FlutterCommand {
}
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
if
(
argResults
.
rest
.
isEmpty
)
throwToolExit
(
'No option specified for the output directory.
\n
$usage
'
,
exitCode:
2
);
...
...
@@ -334,6 +334,8 @@ To edit platform code in an IDE see https://flutter.io/developing-packages/#edit
printStatus
(
'Your application code is in
$relativeAppMain
'
);
}
}
return
null
;
}
Future
<
int
>
_generateApplication
(
Directory
directory
,
Map
<
String
,
dynamic
>
templateContext
)
async
{
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/daemon.dart
View file @
2d3ff10d
...
...
@@ -50,14 +50,14 @@ class DaemonCommand extends FlutterCommand {
final
bool
hidden
;
@override
Future
<
Null
>
runCommand
()
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
printStatus
(
'Starting device daemon...'
);
final
NotifyingLogger
notifyingLogger
=
NotifyingLogger
();
Cache
.
releaseLockEarly
();
return
context
.
run
<
Null
>(
await
context
.
run
<
void
>(
body:
()
async
{
final
Daemon
daemon
=
Daemon
(
stdinCommandStream
,
stdoutCommandResponse
,
...
...
@@ -71,6 +71,7 @@ class DaemonCommand extends FlutterCommand {
Logger:
()
=>
notifyingLogger
,
},
);
return
null
;
}
}
...
...
@@ -295,9 +296,9 @@ class DaemonDomain extends Domain {
return
Future
<
String
>.
value
(
protocolVersion
);
}
Future
<
Null
>
shutdown
(
Map
<
String
,
dynamic
>
args
)
{
Future
<
void
>
shutdown
(
Map
<
String
,
dynamic
>
args
)
{
Timer
.
run
(
daemon
.
shutdown
);
return
Future
<
Null
>.
value
();
return
Future
<
void
>.
value
();
}
@override
...
...
@@ -413,7 +414,7 @@ class AppDomain extends Domain {
connectionInfoCompleter
=
Completer
<
DebugConnectionInfo
>();
// We don't want to wait for this future to complete and callbacks won't fail.
// As it just writes to stdout.
connectionInfoCompleter
.
future
.
then
<
Null
>((
DebugConnectionInfo
info
)
{
// ignore: unawaited_futures
connectionInfoCompleter
.
future
.
then
<
void
>((
DebugConnectionInfo
info
)
{
// ignore: unawaited_futures
final
Map
<
String
,
dynamic
>
params
=
<
String
,
dynamic
>{
'port'
:
info
.
httpUri
.
port
,
'wsUri'
:
info
.
wsUri
.
toString
(),
...
...
@@ -435,7 +436,7 @@ class AppDomain extends Domain {
_sendAppEvent
(
app
,
'started'
);
});
await
app
.
_runInZone
<
Null
>(
this
,
()
async
{
await
app
.
_runInZone
<
void
>(
this
,
()
async
{
try
{
await
runOrAttach
(
connectionInfoCompleter:
connectionInfoCompleter
,
...
...
@@ -599,11 +600,11 @@ class DeviceDomain extends Domain {
discoverer
.
onRemoved
.
listen
(
_onDeviceEvent
(
'device.removed'
));
}
Future
<
Null
>
_serializeDeviceEvents
=
Future
<
Null
>.
value
();
Future
<
void
>
_serializeDeviceEvents
=
Future
<
void
>.
value
();
_DeviceEventHandler
_onDeviceEvent
(
String
eventName
)
{
return
(
Device
device
)
{
_serializeDeviceEvents
=
_serializeDeviceEvents
.
then
<
Null
>((
_
)
async
{
_serializeDeviceEvents
=
_serializeDeviceEvents
.
then
<
void
>((
_
)
async
{
sendEvent
(
eventName
,
await
_deviceToMap
(
device
));
});
};
...
...
@@ -620,17 +621,17 @@ class DeviceDomain extends Domain {
}
/// Enable device events.
Future
<
Null
>
enable
(
Map
<
String
,
dynamic
>
args
)
{
Future
<
void
>
enable
(
Map
<
String
,
dynamic
>
args
)
{
for
(
PollingDeviceDiscovery
discoverer
in
_discoverers
)
discoverer
.
startPolling
();
return
Future
<
Null
>.
value
();
return
Future
<
void
>.
value
();
}
/// Disable device events.
Future
<
Null
>
disable
(
Map
<
String
,
dynamic
>
args
)
{
Future
<
void
>
disable
(
Map
<
String
,
dynamic
>
args
)
{
for
(
PollingDeviceDiscovery
discoverer
in
_discoverers
)
discoverer
.
stopPolling
();
return
Future
<
Null
>.
value
();
return
Future
<
void
>.
value
();
}
/// Forward a host port to a device port.
...
...
@@ -649,7 +650,7 @@ class DeviceDomain extends Domain {
}
/// Removes a forwarded port.
Future
<
Null
>
unforward
(
Map
<
String
,
dynamic
>
args
)
async
{
Future
<
void
>
unforward
(
Map
<
String
,
dynamic
>
args
)
async
{
final
String
deviceId
=
_getStringArg
(
args
,
'deviceId'
,
required:
true
);
final
int
devicePort
=
_getIntArg
(
args
,
'devicePort'
,
required:
true
);
final
int
hostPort
=
_getIntArg
(
args
,
'hostPort'
,
required:
true
);
...
...
@@ -798,8 +799,8 @@ class AppInstance {
return
runner
.
restart
(
fullRestart:
fullRestart
,
pauseAfterRestart:
pauseAfterRestart
);
}
Future
<
Null
>
stop
()
=>
runner
.
stop
();
Future
<
Null
>
detach
()
=>
runner
.
detach
();
Future
<
void
>
stop
()
=>
runner
.
stop
();
Future
<
void
>
detach
()
=>
runner
.
detach
();
void
closeLogger
()
{
_logger
.
close
();
...
...
@@ -832,7 +833,7 @@ class EmulatorDomain extends Domain {
return
list
.
map
<
Map
<
String
,
dynamic
>>(
_emulatorToMap
).
toList
();
}
Future
<
Null
>
launch
(
Map
<
String
,
dynamic
>
args
)
async
{
Future
<
void
>
launch
(
Map
<
String
,
dynamic
>
args
)
async
{
final
String
emulatorId
=
_getStringArg
(
args
,
'emulatorId'
,
required:
true
);
final
List
<
Emulator
>
matches
=
await
emulators
.
getEmulatorsMatching
(
emulatorId
);
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/devices.dart
View file @
2d3ff10d
...
...
@@ -19,7 +19,7 @@ class DevicesCommand extends FlutterCommand {
final
String
description
=
'List all connected devices.'
;
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
if
(!
doctor
.
canListAnything
)
{
throwToolExit
(
"Unable to locate a development device; please run 'flutter doctor' for "
...
...
@@ -46,5 +46,7 @@ class DevicesCommand extends FlutterCommand {
printStatus
(
'
${devices.length}
connected
${pluralize('device', devices.length)}
:
\n
'
);
await
Device
.
printDevices
(
devices
);
}
return
null
;
}
}
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/drive.dart
View file @
2d3ff10d
...
...
@@ -14,6 +14,7 @@ import '../dart/sdk.dart';
import
'../device.dart'
;
import
'../globals.dart'
;
import
'../resident_runner.dart'
;
import
'../runner/flutter_command.dart'
show
FlutterCommandResult
;
import
'run.dart'
;
/// Runs integration (a.k.a. end-to-end) tests.
...
...
@@ -82,7 +83,7 @@ class DriveCommand extends RunCommandBase {
StreamSubscription
<
String
>
_deviceLogSubscription
;
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
final
String
testFile
=
_getTestFile
();
if
(
testFile
==
null
)
throwToolExit
(
null
);
...
...
@@ -133,6 +134,8 @@ class DriveCommand extends RunCommandBase {
await
appStopper
(
this
);
}
}
return
null
;
}
String
_getTestFile
()
{
...
...
@@ -272,13 +275,13 @@ Future<LaunchResult> _startApp(DriveCommand command) async {
}
/// Runs driver tests.
typedef
TestRunner
=
Future
<
Null
>
Function
(
List
<
String
>
testArgs
,
String
observatoryUri
);
typedef
TestRunner
=
Future
<
void
>
Function
(
List
<
String
>
testArgs
,
String
observatoryUri
);
TestRunner
testRunner
=
_runTests
;
void
restoreTestRunner
(
)
{
testRunner
=
_runTests
;
}
Future
<
Null
>
_runTests
(
List
<
String
>
testArgs
,
String
observatoryUri
)
async
{
Future
<
void
>
_runTests
(
List
<
String
>
testArgs
,
String
observatoryUri
)
async
{
printTrace
(
'Running driver tests.'
);
PackageMap
.
globalPackagesPath
=
fs
.
path
.
normalize
(
fs
.
path
.
absolute
(
PackageMap
.
globalPackagesPath
));
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/emulators.dart
View file @
2d3ff10d
...
...
@@ -33,7 +33,7 @@ class EmulatorsCommand extends FlutterCommand {
final
List
<
String
>
aliases
=
<
String
>[
'emulator'
];
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
if
(
doctor
.
workflows
.
every
((
Workflow
w
)
=>
!
w
.
canListEmulators
))
{
throwToolExit
(
'Unable to find any emulator sources. Please ensure you have some
\n
'
...
...
@@ -54,6 +54,8 @@ class EmulatorsCommand extends FlutterCommand {
:
null
;
await
_listEmulators
(
searchText
);
}
return
null
;
}
Future
<
void
>
_launchEmulator
(
String
id
)
async
{
...
...
@@ -81,7 +83,7 @@ class EmulatorsCommand extends FlutterCommand {
}
}
Future
<
Null
>
_createEmulator
({
String
name
})
async
{
Future
<
void
>
_createEmulator
({
String
name
})
async
{
final
CreateEmulatorResult
createResult
=
await
emulatorManager
.
createEmulator
(
name:
name
);
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/format.dart
View file @
2d3ff10d
...
...
@@ -43,7 +43,7 @@ class FormatCommand extends FlutterCommand {
String
get
invocation
=>
'
${runner.executableName}
$name
<one or more paths>'
;
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
if
(
argResults
.
rest
.
isEmpty
)
{
throwToolExit
(
'No files specified to be formatted.
\n
'
...
...
@@ -77,5 +77,7 @@ class FormatCommand extends FlutterCommand {
final
int
result
=
await
runCommandAndStreamOutput
(
command
);
if
(
result
!=
0
)
throwToolExit
(
'Formatting failed:
$result
'
,
exitCode:
result
);
return
null
;
}
}
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/fuchsia_reload.dart
View file @
2d3ff10d
...
...
@@ -102,7 +102,7 @@ class FuchsiaReloadCommand extends FlutterCommand {
bool
_list
;
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
Cache
.
releaseLockEarly
();
await
_validateArguments
();
...
...
@@ -130,7 +130,7 @@ class FuchsiaReloadCommand extends FlutterCommand {
// continue to work.
printStatus
(
'Press Enter to exit.'
);
await
stdin
.
first
;
return
;
return
null
;
}
// Check that there are running VM services on the returned
...
...
@@ -168,8 +168,10 @@ class FuchsiaReloadCommand extends FlutterCommand {
printStatus
(
'Connecting to
$_modName
'
);
await
hotRunner
.
attach
(
viewFilter:
isolateName
);
}
finally
{
await
Future
.
wait
<
Null
>(
forwardedPorts
.
map
<
Future
<
Null
>>((
_PortForwarder
pf
)
=>
pf
.
stop
()));
await
Future
.
wait
<
void
>(
forwardedPorts
.
map
<
Future
<
void
>>((
_PortForwarder
pf
)
=>
pf
.
stop
()));
}
return
null
;
}
// A cache of VMService connections.
...
...
@@ -286,7 +288,7 @@ class FuchsiaReloadCommand extends FlutterCommand {
'
${extraTabs}
External:
$external
\n
'
;
}
Future
<
Null
>
_listVMs
(
List
<
int
>
ports
)
async
{
Future
<
void
>
_listVMs
(
List
<
int
>
ports
)
async
{
for
(
int
port
in
ports
)
{
final
VMService
vmService
=
await
_getVMService
(
port
);
await
vmService
.
getVM
();
...
...
@@ -295,7 +297,7 @@ class FuchsiaReloadCommand extends FlutterCommand {
}
}
Future
<
Null
>
_validateArguments
()
async
{
Future
<
void
>
_validateArguments
()
async
{
final
String
fuchsiaBuildDir
=
argResults
[
'build-dir'
];
final
String
gnTarget
=
argResults
[
'gn-target'
];
...
...
@@ -485,7 +487,7 @@ class _PortForwarder {
return
_PortForwarder
.
_
(
address
,
remotePort
,
localPort
,
process
,
sshConfig
);
}
Future
<
Null
>
stop
()
async
{
Future
<
void
>
stop
()
async
{
// Kill the original ssh process if it is still around.
if
(
_process
!=
null
)
{
printTrace
(
'_PortForwarder killing
${_process.pid}
for port
$_localPort
'
);
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/ide_config.dart
View file @
2d3ff10d
...
...
@@ -218,7 +218,7 @@ class IdeConfigCommand extends FlutterCommand {
}
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
if
(
argResults
.
rest
.
isNotEmpty
)
{
throwToolExit
(
'Currently, the only supported IDE is IntelliJ
\n
$usage
'
,
exitCode:
2
);
}
...
...
@@ -227,7 +227,7 @@ class IdeConfigCommand extends FlutterCommand {
if
(
argResults
[
'update-templates'
])
{
_handleTemplateUpdate
();
return
;
return
null
;
}
final
String
flutterRoot
=
fs
.
path
.
absolute
(
Cache
.
flutterRoot
);
...
...
@@ -250,6 +250,8 @@ class IdeConfigCommand extends FlutterCommand {
printStatus
(
''
);
printStatus
(
'Your IntelliJ configuration is now up to date. It is prudent to '
'restart IntelliJ, if running.'
);
return
null
;
}
int
_renderTemplate
(
String
templateName
,
String
dirPath
,
Map
<
String
,
dynamic
>
context
)
{
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/inject_plugins.dart
View file @
2d3ff10d
...
...
@@ -24,7 +24,7 @@ class InjectPluginsCommand extends FlutterCommand {
final
bool
hidden
;
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
final
FlutterProject
project
=
await
FlutterProject
.
current
();
refreshPluginsList
(
project
);
await
injectPlugins
(
project
);
...
...
@@ -34,5 +34,7 @@ class InjectPluginsCommand extends FlutterCommand {
}
else
{
printStatus
(
'This project does not use plugins, no GeneratedPluginRegistrants have been created.'
);
}
return
null
;
}
}
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/install.dart
View file @
2d3ff10d
...
...
@@ -25,7 +25,7 @@ class InstallCommand extends FlutterCommand {
Device
device
;
@override
Future
<
Null
>
validateCommand
()
async
{
Future
<
void
>
validateCommand
()
async
{
await
super
.
validateCommand
();
device
=
await
findTargetDevice
();
if
(
device
==
null
)
...
...
@@ -33,7 +33,7 @@ class InstallCommand extends FlutterCommand {
}
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
final
ApplicationPackage
package
=
await
applicationPackages
.
getPackageForPlatform
(
await
device
.
targetPlatform
);
Cache
.
releaseLockEarly
();
...
...
@@ -42,6 +42,8 @@ class InstallCommand extends FlutterCommand {
if
(!
await
installApp
(
device
,
package
))
throwToolExit
(
'Install failed'
);
return
null
;
}
}
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/logs.dart
View file @
2d3ff10d
...
...
@@ -37,7 +37,7 @@ class LogsCommand extends FlutterCommand {
}
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
if
(
argResults
[
'clear'
])
device
.
clearLogs
();
...
...
@@ -76,5 +76,7 @@ class LogsCommand extends FlutterCommand {
await
subscription
.
cancel
();
if
(
result
!=
0
)
throwToolExit
(
'Error listening to
$logReader
logs.'
);
return
null
;
}
}
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/make_host_app_editable.dart
View file @
2d3ff10d
...
...
@@ -24,7 +24,7 @@ class MakeHostAppEditableCommand extends FlutterCommand {
bool
get
hidden
=>
true
;
@override
Future
<
Null
>
runCommand
()
async
{
}
Future
<
FlutterCommandResult
>
runCommand
()
async
=>
null
;
}
abstract
class
MakeHostAppEditableSubCommand
extends
FlutterCommand
{
...
...
@@ -36,12 +36,13 @@ abstract class MakeHostAppEditableSubCommand extends FlutterCommand {
@override
@mustCallSuper
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
_project
.
ensureReadyForPlatformSpecificTooling
();
return
null
;
}
@override
Future
<
Null
>
validateCommand
()
async
{
Future
<
void
>
validateCommand
()
async
{
await
super
.
validateCommand
();
_project
=
await
FlutterProject
.
current
();
if
(!
_project
.
isApplication
)
...
...
@@ -57,9 +58,11 @@ class MakeHostAppEditableAndroidCommand extends MakeHostAppEditableSubCommand {
String
get
description
=>
'Make an Android host app editable within a Flutter project'
;
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
super
.
runCommand
();
await
_project
.
android
.
makeHostAppEditable
();
return
null
;
}
}
...
...
@@ -71,8 +74,10 @@ class MakeHostAppEditableIosCommand extends MakeHostAppEditableSubCommand {
String
get
description
=>
'Make an iOS host app editable within a Flutter project'
;
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
super
.
runCommand
();
await
_project
.
ios
.
makeHostAppEditable
();
return
null
;
}
}
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/packages.dart
View file @
2d3ff10d
...
...
@@ -28,7 +28,7 @@ class PackagesCommand extends FlutterCommand {
final
String
description
=
'Commands for managing Flutter packages.'
;
@override
Future
<
Null
>
runCommand
()
async
{
}
Future
<
FlutterCommandResult
>
runCommand
()
async
=>
null
;
}
class
PackagesGetCommand
extends
FlutterCommand
{
...
...
@@ -65,7 +65,7 @@ class PackagesGetCommand extends FlutterCommand {
}
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
if
(
argResults
.
rest
.
length
>
1
)
throwToolExit
(
'Too many arguments.
\n
$usage
'
);
...
...
@@ -89,6 +89,8 @@ class PackagesGetCommand extends FlutterCommand {
await
_runPubGet
(
exampleProject
.
directory
.
path
);
await
exampleProject
.
ensureReadyForPlatformSpecificTooling
();
}
return
null
;
}
}
...
...
@@ -116,7 +118,10 @@ class PackagesTestCommand extends FlutterCommand {
}
@override
Future
<
Null
>
runCommand
()
=>
pub
(<
String
>[
'run'
,
'test'
]..
addAll
(
argResults
.
rest
),
context:
PubContext
.
runTest
,
retry:
false
);
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
pub
(<
String
>[
'run'
,
'test'
]..
addAll
(
argResults
.
rest
),
context:
PubContext
.
runTest
,
retry:
false
);
return
null
;
}
}
class
PackagesPassthroughCommand
extends
FlutterCommand
{
...
...
@@ -139,5 +144,8 @@ class PackagesPassthroughCommand extends FlutterCommand {
}
@override
Future
<
Null
>
runCommand
()
=>
pubInteractively
(
argResults
.
rest
);
Future
<
FlutterCommandResult
>
runCommand
()
async
{
await
pubInteractively
(
argResults
.
rest
);
return
null
;
}
}
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/precache.dart
View file @
2d3ff10d
...
...
@@ -23,7 +23,7 @@ class PrecacheCommand extends FlutterCommand {
bool
get
shouldUpdateCache
=>
false
;
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
if
(
argResults
[
'all-platforms'
])
cache
.
includeAllPlatforms
=
true
;
...
...
@@ -31,5 +31,7 @@ class PrecacheCommand extends FlutterCommand {
printStatus
(
'Already up-to-date.'
);
else
await
cache
.
updateAll
();
return
null
;
}
}
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/run.dart
View file @
2d3ff10d
...
...
@@ -237,7 +237,7 @@ class RunCommand extends RunCommandBase {
bool
get
stayResident
=>
argResults
[
'resident'
];
@override
Future
<
Null
>
validateCommand
()
async
{
Future
<
void
>
validateCommand
()
async
{
// When running with a prebuilt application, no command validation is
// necessary.
if
(!
runningWithPrebuiltApplication
)
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/screenshot.dart
View file @
2d3ff10d
...
...
@@ -76,22 +76,27 @@ class ScreenshotCommand extends FlutterCommand {
}
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
File
outputFile
;
if
(
argResults
.
wasParsed
(
_kOut
))
outputFile
=
fs
.
file
(
argResults
[
_kOut
]);
switch
(
argResults
[
_kType
])
{
case
_kDeviceType:
return
runScreenshot
(
outputFile
);
await
runScreenshot
(
outputFile
);
return
null
;
case
_kSkiaType:
return
runSkia
(
outputFile
);
await
runSkia
(
outputFile
);
return
null
;
case
_kRasterizerType:
return
runRasterizer
(
outputFile
);
await
runRasterizer
(
outputFile
);
return
null
;
}
return
null
;
}
Future
<
Null
>
runScreenshot
(
File
outputFile
)
async
{
Future
<
void
>
runScreenshot
(
File
outputFile
)
async
{
outputFile
??=
getUniqueFile
(
fs
.
currentDirectory
,
'flutter'
,
'png'
);
try
{
await
device
.
takeScreenshot
(
outputFile
);
...
...
@@ -101,7 +106,7 @@ class ScreenshotCommand extends FlutterCommand {
await
showOutputFileInfo
(
outputFile
);
}
Future
<
Null
>
runSkia
(
File
outputFile
)
async
{
Future
<
void
>
runSkia
(
File
outputFile
)
async
{
final
Map
<
String
,
dynamic
>
skp
=
await
_invokeVmServiceRpc
(
'_flutter.screenshotSkp'
);
outputFile
??=
getUniqueFile
(
fs
.
currentDirectory
,
'flutter'
,
'skp'
);
final
IOSink
sink
=
outputFile
.
openWrite
();
...
...
@@ -138,7 +143,7 @@ class ScreenshotCommand extends FlutterCommand {
}
}
Future
<
Null
>
showOutputFileInfo
(
File
outputFile
)
async
{
Future
<
void
>
showOutputFileInfo
(
File
outputFile
)
async
{
final
int
sizeKB
=
(
await
outputFile
.
length
())
~/
1024
;
printStatus
(
'Screenshot written to
${fs.path.relative(outputFile.path)}
(
${sizeKB}
kB).'
);
}
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/shell_completion.dart
View file @
2d3ff10d
...
...
@@ -42,14 +42,14 @@ class ShellCompletionCommand extends FlutterCommand {
Future
<
String
>
get
usagePath
=>
null
;
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
if
(
argResults
.
rest
.
length
>
1
)
{
throwToolExit
(
'Too many arguments given to bash-completion command.'
,
exitCode:
1
);
}
if
(
argResults
.
rest
.
isEmpty
||
argResults
.
rest
.
first
==
'-'
)
{
stdout
.
write
(
generateCompletionScript
(<
String
>[
'flutter'
]));
return
;
return
null
;
}
final
File
outputFile
=
fs
.
file
(
argResults
.
rest
.
first
);
...
...
@@ -65,5 +65,7 @@ class ShellCompletionCommand extends FlutterCommand {
}
on
FileSystemException
catch
(
error
)
{
throwToolExit
(
'Unable to write shell completion setup script.
\n
$error
'
,
exitCode:
1
);
}
return
null
;
}
}
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/stop.dart
View file @
2d3ff10d
...
...
@@ -25,7 +25,7 @@ class StopCommand extends FlutterCommand {
Device
device
;
@override
Future
<
Null
>
validateCommand
()
async
{
Future
<
void
>
validateCommand
()
async
{
await
super
.
validateCommand
();
device
=
await
findTargetDevice
();
if
(
device
==
null
)
...
...
@@ -33,7 +33,7 @@ class StopCommand extends FlutterCommand {
}
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
final
TargetPlatform
targetPlatform
=
await
device
.
targetPlatform
;
final
ApplicationPackage
app
=
await
applicationPackages
.
getPackageForPlatform
(
targetPlatform
);
if
(
app
==
null
)
{
...
...
@@ -43,5 +43,7 @@ class StopCommand extends FlutterCommand {
printStatus
(
'Stopping apps on
${device.name}
.'
);
if
(!
await
device
.
stopApp
(
app
))
throwToolExit
(
null
);
return
null
;
}
}
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/test.dart
View file @
2d3ff10d
...
...
@@ -89,7 +89,7 @@ class TestCommand extends FlutterCommand {
String
get
description
=>
'Run Flutter unit tests for the current project.'
;
@override
Future
<
Null
>
validateCommand
()
async
{
Future
<
void
>
validateCommand
()
async
{
await
super
.
validateCommand
();
if
(!
fs
.
isFileSync
(
'pubspec.yaml'
))
{
throwToolExit
(
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/trace.dart
View file @
2d3ff10d
...
...
@@ -44,7 +44,7 @@ class TraceCommand extends FlutterCommand {
'The --debug-port argument is required.'
;
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
int
observatoryPort
;
if
(
argResults
.
wasParsed
(
'debug-port'
))
{
observatoryPort
=
int
.
tryParse
(
argResults
[
'debug-port'
]);
...
...
@@ -88,12 +88,14 @@ class TraceCommand extends FlutterCommand {
if
(
start
)
await
tracing
.
startTracing
();
await
Future
<
Null
>.
delayed
(
duration
);
await
Future
<
void
>.
delayed
(
duration
);
if
(
stop
)
await
_stopTracing
(
tracing
);
return
null
;
}
Future
<
Null
>
_stopTracing
(
Tracing
tracing
)
async
{
Future
<
void
>
_stopTracing
(
Tracing
tracing
)
async
{
final
Map
<
String
,
dynamic
>
timeline
=
await
tracing
.
stopTracingAndDownloadTimeline
();
File
localFile
;
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/update_packages.dart
View file @
2d3ff10d
...
...
@@ -82,7 +82,7 @@ class UpdatePackagesCommand extends FlutterCommand {
@override
final
bool
hidden
;
Future
<
Null
>
_downloadCoverageData
()
async
{
Future
<
void
>
_downloadCoverageData
()
async
{
final
Status
status
=
logger
.
startProgress
(
'Downloading lcov data for package:flutter...'
,
expectSlowOperation:
true
,
...
...
@@ -100,7 +100,7 @@ class UpdatePackagesCommand extends FlutterCommand {
}
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
final
List
<
Directory
>
packages
=
runner
.
getRepoPackages
();
final
bool
upgrade
=
argResults
[
'force-upgrade'
];
...
...
@@ -163,7 +163,7 @@ class UpdatePackagesCommand extends FlutterCommand {
);
}
printStatus
(
'All pubspecs were up to date.'
);
return
;
return
null
;
}
if
(
upgrade
||
isPrintPaths
||
isPrintTransitiveClosure
)
{
...
...
@@ -265,12 +265,12 @@ class UpdatePackagesCommand extends FlutterCommand {
tree
.
_dependencyTree
.
forEach
((
String
from
,
Set
<
String
>
to
)
{
printStatus
(
'
$from
->
$to
'
);
});
return
;
return
null
;
}
if
(
isPrintPaths
)
{
showDependencyPaths
(
from:
argResults
[
'from'
],
to:
argResults
[
'to'
],
tree:
tree
);
return
;
return
null
;
}
// Now that we have collected all the data, we can apply our dependency
...
...
@@ -302,6 +302,8 @@ class UpdatePackagesCommand extends FlutterCommand {
final
double
seconds
=
timer
.
elapsedMilliseconds
/
1000.0
;
printStatus
(
'
\n
Ran
\'
pub
\'
$count
time
${count == 1 ? "" : "s"}
and fetched coverage data in
${seconds.toStringAsFixed(1)}
s.'
);
return
null
;
}
void
showDependencyPaths
({
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/commands/upgrade.dart
View file @
2d3ff10d
...
...
@@ -28,7 +28,7 @@ class UpgradeCommand extends FlutterCommand {
bool
get
shouldUpdateCache
=>
false
;
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
try
{
await
runCheckedAsync
(<
String
>[
'git'
,
'rev-parse'
,
'@{u}'
...
...
@@ -85,6 +85,8 @@ class UpgradeCommand extends FlutterCommand {
workingDirectory:
Cache
.
flutterRoot
,
allowReentrantFlutter:
true
,
);
return
null
;
}
// dev/benchmarks/complex_layout/lib/main.dart | 24 +-
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/crash_reporting.dart
View file @
2d3ff10d
...
...
@@ -80,7 +80,7 @@ class CrashReportSender {
/// Sends one crash report.
///
/// The report is populated from data in [error] and [stackTrace].
Future
<
Null
>
sendReport
({
Future
<
void
>
sendReport
({
@required
dynamic
error
,
@required
StackTrace
stackTrace
,
@required
String
getFlutterVersion
(),
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/dart/analysis.dart
View file @
2d3ff10d
...
...
@@ -27,7 +27,7 @@ class AnalysisServer {
int
_id
=
0
;
Future
<
Null
>
start
()
async
{
Future
<
void
>
start
()
async
{
final
String
snapshot
=
fs
.
path
.
join
(
sdkPath
,
'bin/snapshots/analysis_server.dart.snapshot'
);
final
List
<
String
>
command
=
<
String
>[
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/dart/pub.dart
View file @
2d3ff10d
...
...
@@ -69,7 +69,7 @@ bool _shouldRunPubGet({ File pubSpecYaml, File dotPackages }) {
/// [context] provides extra information to package server requests to
/// understand usage.
Future
<
Null
>
pubGet
({
Future
<
void
>
pubGet
({
@required
PubContext
context
,
String
directory
,
bool
skipIfAbsent
=
false
,
...
...
@@ -135,7 +135,7 @@ typedef MessageFilter = String Function(String message);
///
/// [context] provides extra information to package server requests to
/// understand usage.
Future
<
Null
>
pub
(
List
<
String
>
arguments
,
{
Future
<
void
>
pub
(
List
<
String
>
arguments
,
{
@required
PubContext
context
,
String
directory
,
MessageFilter
filter
,
...
...
@@ -161,7 +161,7 @@ Future<Null> pub(List<String> arguments, {
if
(
code
!=
69
)
// UNAVAILABLE in https://github.com/dart-lang/pub/blob/master/lib/src/exit_codes.dart
break
;
printStatus
(
'
$failureMessage
(
$code
) -- attempting retry
$attempts
in
$duration
second
${ duration == 1 ? "" : "s"}
...'
);
await
Future
<
Null
>.
delayed
(
Duration
(
seconds:
duration
));
await
Future
<
void
>.
delayed
(
Duration
(
seconds:
duration
));
if
(
duration
<
64
)
duration
*=
2
;
}
...
...
@@ -173,7 +173,7 @@ Future<Null> pub(List<String> arguments, {
/// Runs pub in 'interactive' mode, directly piping the stdin stream of this
/// process to that of pub, and the stdout/stderr stream of pub to the corresponding
/// streams of this process.
Future
<
Null
>
pubInteractively
(
List
<
String
>
arguments
,
{
Future
<
void
>
pubInteractively
(
List
<
String
>
arguments
,
{
String
directory
,
})
async
{
Cache
.
releaseLockEarly
();
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/devfs.dart
View file @
2d3ff10d
...
...
@@ -264,13 +264,13 @@ class _DevFSHttpWriter {
int
_inFlight
=
0
;
Map
<
Uri
,
DevFSContent
>
_outstanding
;
Completer
<
Null
>
_completer
;
Completer
<
void
>
_completer
;
HttpClient
_client
;
Future
<
Null
>
write
(
Map
<
Uri
,
DevFSContent
>
entries
)
async
{
Future
<
void
>
write
(
Map
<
Uri
,
DevFSContent
>
entries
)
async
{
_client
=
HttpClient
();
_client
.
maxConnectionsPerHost
=
kMaxInFlight
;
_completer
=
Completer
<
Null
>();
_completer
=
Completer
<
void
>();
_outstanding
=
Map
<
Uri
,
DevFSContent
>.
from
(
entries
);
_scheduleWrites
();
await
_completer
.
future
;
...
...
@@ -290,7 +290,7 @@ class _DevFSHttpWriter {
}
}
Future
<
Null
>
_scheduleWrite
(
Future
<
void
>
_scheduleWrite
(
Uri
deviceUri
,
DevFSContent
content
,
[
int
retry
=
0
,
...
...
@@ -304,7 +304,7 @@ class _DevFSHttpWriter {
final
Stream
<
List
<
int
>>
contents
=
content
.
contentsAsCompressedStream
();
await
request
.
addStream
(
contents
);
final
HttpClientResponse
response
=
await
request
.
close
();
await
response
.
drain
<
Null
>();
await
response
.
drain
<
void
>();
}
on
SocketException
catch
(
socketException
,
stackTrace
)
{
// We have one completer and can get up to kMaxInFlight errors.
if
(!
_completer
.
isCompleted
)
...
...
@@ -322,7 +322,7 @@ class _DevFSHttpWriter {
}
_inFlight
--;
if
((
_outstanding
.
isEmpty
)
&&
(
_inFlight
==
0
))
{
_completer
.
complete
(
null
);
_completer
.
complete
();
}
else
{
_scheduleWrites
();
}
...
...
@@ -392,7 +392,7 @@ class DevFS {
return
_baseUri
;
}
Future
<
Null
>
destroy
()
async
{
Future
<
void
>
destroy
()
async
{
printTrace
(
'DevFS: Deleting filesystem on the device (
$_baseUri
)'
);
await
_operations
.
destroy
(
fsName
);
printTrace
(
'DevFS: Deleted filesystem on the device (
$_baseUri
)'
);
...
...
@@ -701,7 +701,7 @@ class DevFS {
);
}
Future
<
Null
>
_scanPackages
(
Set
<
String
>
fileFilter
)
async
{
Future
<
void
>
_scanPackages
(
Set
<
String
>
fileFilter
)
async
{
StringBuffer
sb
;
final
PackageMap
packageMap
=
PackageMap
(
_packagesFilePath
);
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/device.dart
View file @
2d3ff10d
...
...
@@ -275,7 +275,7 @@ abstract class Device {
bool
get
supportsScreenshot
=>
false
;
Future
<
void
>
takeScreenshot
(
File
outputFile
)
=>
Future
<
Null
>.
error
(
'unimplemented'
);
Future
<
void
>
takeScreenshot
(
File
outputFile
)
=>
Future
<
void
>.
error
(
'unimplemented'
);
@override
int
get
hashCode
=>
id
.
hashCode
;
...
...
@@ -326,7 +326,7 @@ abstract class Device {
}
}
static
Future
<
Null
>
printDevices
(
List
<
Device
>
devices
)
async
{
static
Future
<
void
>
printDevices
(
List
<
Device
>
devices
)
async
{
await
descriptions
(
devices
).
forEach
(
printStatus
);
}
}
...
...
@@ -405,7 +405,7 @@ abstract class DevicePortForwarder {
Future
<
int
>
forward
(
int
devicePort
,
{
int
hostPort
});
/// Stops forwarding [forwardedPort].
Future
<
Null
>
unforward
(
ForwardedPort
forwardedPort
);
Future
<
void
>
unforward
(
ForwardedPort
forwardedPort
);
}
/// Read the log for a particular device.
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/disabled_usage.dart
View file @
2d3ff10d
...
...
@@ -41,7 +41,7 @@ class DisabledUsage implements Usage {
Stream
<
Map
<
String
,
dynamic
>>
get
onSend
=>
null
;
@override
Future
<
Null
>
ensureAnalyticsSent
()
=>
Future
<
Null
>.
value
();
Future
<
void
>
ensureAnalyticsSent
()
=>
Future
<
void
>.
value
();
@override
void
printWelcome
()
{
}
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/doctor.dart
View file @
2d3ff10d
...
...
@@ -112,7 +112,7 @@ class Doctor {
}
/// Print a summary of the state of the tooling, as well as how to get more info.
Future
<
Null
>
summary
()
async
{
Future
<
void
>
summary
()
async
{
printStatus
(
await
summaryText
);
}
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/fuchsia/fuchsia_device.dart
View file @
2d3ff10d
...
...
@@ -68,7 +68,7 @@ class FuchsiaDevice extends Device {
bool
applicationNeedsRebuild
=
false
,
bool
usesTerminalUi
=
false
,
bool
ipv6
=
false
,
})
=>
Future
<
Null
>.
error
(
'unimplemented'
);
})
=>
Future
<
void
>.
error
(
'unimplemented'
);
@override
Future
<
bool
>
stopApp
(
ApplicationPackage
app
)
async
{
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/ios/cocoapods.dart
View file @
2d3ff10d
...
...
@@ -219,7 +219,7 @@ class CocoaPods {
||
podfileLockFile
.
readAsStringSync
()
!=
manifestLockFile
.
readAsStringSync
();
}
Future
<
Null
>
_runPodInstall
(
IosProject
iosProject
,
String
engineDirectory
)
async
{
Future
<
void
>
_runPodInstall
(
IosProject
iosProject
,
String
engineDirectory
)
async
{
final
Status
status
=
logger
.
startProgress
(
'Running pod install...'
,
expectSlowOperation:
true
);
final
ProcessResult
result
=
await
processManager
.
run
(
<
String
>[
'pod'
,
'install'
,
'--verbose'
],
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/ios/devices.dart
View file @
2d3ff10d
...
...
@@ -376,7 +376,7 @@ class IOSDevice extends Device {
bool
get
supportsScreenshot
=>
iMobileDevice
.
isInstalled
;
@override
Future
<
Null
>
takeScreenshot
(
File
outputFile
)
async
{
Future
<
void
>
takeScreenshot
(
File
outputFile
)
async
{
await
iMobileDevice
.
takeScreenshot
(
outputFile
);
}
}
...
...
@@ -475,7 +475,7 @@ class _IOSDeviceLogReader extends DeviceLogReader {
String
get
name
=>
device
.
name
;
void
_start
()
{
iMobileDevice
.
startLogger
().
then
<
Null
>((
Process
process
)
{
iMobileDevice
.
startLogger
().
then
<
void
>((
Process
process
)
{
_process
=
process
;
_process
.
stdout
.
transform
<
String
>(
utf8
.
decoder
).
transform
<
String
>(
const
LineSplitter
()).
listen
(
_newLineHandler
());
_process
.
stderr
.
transform
<
String
>(
utf8
.
decoder
).
transform
<
String
>(
const
LineSplitter
()).
listen
(
_newLineHandler
());
...
...
@@ -576,7 +576,7 @@ class _IOSDevicePortForwarder extends DevicePortForwarder {
}
@override
Future
<
Null
>
unforward
(
ForwardedPort
forwardedPort
)
async
{
Future
<
void
>
unforward
(
ForwardedPort
forwardedPort
)
async
{
if
(!
_forwardedPorts
.
remove
(
forwardedPort
))
{
// Not in list. Nothing to remove.
return
null
;
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/ios/mac.dart
View file @
2d3ff10d
...
...
@@ -530,7 +530,7 @@ String readGeneratedXcconfig(String appPath) {
return
generatedXcconfigFile
.
readAsStringSync
();
}
Future
<
Null
>
diagnoseXcodeBuildFailure
(
XcodeBuildResult
result
)
async
{
Future
<
void
>
diagnoseXcodeBuildFailure
(
XcodeBuildResult
result
)
async
{
if
(
result
.
xcodeBuildExecution
!=
null
&&
result
.
xcodeBuildExecution
.
buildForPhysicalDevice
&&
result
.
stdout
?.
contains
(
'BCEROR'
)
==
true
&&
...
...
@@ -625,7 +625,7 @@ bool _checkXcodeVersion() {
return
true
;
}
Future
<
Null
>
_addServicesToBundle
(
Directory
bundle
)
async
{
Future
<
void
>
_addServicesToBundle
(
Directory
bundle
)
async
{
final
List
<
Map
<
String
,
String
>>
services
=
<
Map
<
String
,
String
>>[];
printTrace
(
'Trying to resolve native pub services.'
);
...
...
@@ -644,7 +644,7 @@ Future<Null> _addServicesToBundle(Directory bundle) async {
_copyServiceDefinitionsManifest
(
services
,
manifestFile
);
}
Future
<
Null
>
_copyServiceFrameworks
(
List
<
Map
<
String
,
String
>>
services
,
Directory
frameworksDirectory
)
async
{
Future
<
void
>
_copyServiceFrameworks
(
List
<
Map
<
String
,
String
>>
services
,
Directory
frameworksDirectory
)
async
{
printTrace
(
"Copying service frameworks to '
${fs.path.absolute(frameworksDirectory.path)}
'."
);
frameworksDirectory
.
createSync
(
recursive:
true
);
for
(
Map
<
String
,
String
>
service
in
services
)
{
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/ios/simulators.dart
View file @
2d3ff10d
...
...
@@ -438,7 +438,7 @@ class IOSSimulator extends Device {
}
}
Future
<
Null
>
ensureLogsExists
()
async
{
Future
<
void
>
ensureLogsExists
()
async
{
if
(
await
sdkMajorVersion
<
11
)
{
final
File
logFile
=
fs
.
file
(
logFilePath
);
if
(!
logFile
.
existsSync
())
...
...
@@ -506,7 +506,7 @@ class _IOSSimulatorLogReader extends DeviceLogReader {
@override
String
get
name
=>
device
.
name
;
Future
<
Null
>
_start
()
async
{
Future
<
void
>
_start
()
async
{
// Device log.
await
device
.
ensureLogsExists
();
_deviceProcess
=
await
launchDeviceLogTool
(
device
);
...
...
@@ -695,7 +695,7 @@ class _IOSSimulatorDevicePortForwarder extends DevicePortForwarder {
}
@override
Future
<
Null
>
unforward
(
ForwardedPort
forwardedPort
)
async
{
Future
<
void
>
unforward
(
ForwardedPort
forwardedPort
)
async
{
_ports
.
remove
(
forwardedPort
);
}
}
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/protocol_discovery.dart
View file @
2d3ff10d
...
...
@@ -50,9 +50,9 @@ class ProtocolDiscovery {
/// The discovered service URI.
Future
<
Uri
>
get
uri
=>
_completer
.
future
;
Future
<
Null
>
cancel
()
=>
_stopScrapingLogs
();
Future
<
void
>
cancel
()
=>
_stopScrapingLogs
();
Future
<
Null
>
_stopScrapingLogs
()
async
{
Future
<
void
>
_stopScrapingLogs
()
async
{
await
_deviceLogSubscription
?.
cancel
();
_deviceLogSubscription
=
null
;
}
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/resident_runner.dart
View file @
2d3ff10d
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/run_cold.dart
View file @
2d3ff10d
...
...
@@ -109,16 +109,16 @@ class ColdRunner extends ResidentRunner {
}
@override
Future
<
Null
>
handleTerminalCommand
(
String
code
)
async
=>
null
;
Future
<
void
>
handleTerminalCommand
(
String
code
)
async
=>
null
;
@override
Future
<
Null
>
cleanupAfterSignal
()
async
{
Future
<
void
>
cleanupAfterSignal
()
async
{
await
stopEchoingDeviceLog
();
await
stopApp
();
}
@override
Future
<
Null
>
cleanupAtFinish
()
async
{
Future
<
void
>
cleanupAtFinish
()
async
{
await
stopEchoingDeviceLog
();
}
...
...
@@ -152,7 +152,7 @@ class ColdRunner extends ResidentRunner {
}
@override
Future
<
Null
>
preStop
()
async
{
Future
<
void
>
preStop
()
async
{
for
(
FlutterDevice
device
in
flutterDevices
)
{
// If we're running in release mode, stop the app using the device logic.
if
(
device
.
vmServices
==
null
||
device
.
vmServices
.
isEmpty
)
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/run_hot.dart
View file @
2d3ff10d
...
...
@@ -120,7 +120,7 @@ class HotRunner extends ResidentRunner {
return
true
;
}
Future
<
Null
>
_reloadSourcesService
(
String
isolateId
,
Future
<
void
>
_reloadSourcesService
(
String
isolateId
,
{
bool
force
=
false
,
bool
pause
=
false
})
async
{
// TODO(cbernaschina): check that isolateId is the id of the UI isolate.
final
OperationResult
result
=
await
restart
(
pauseAfterRestart:
pause
);
...
...
@@ -276,7 +276,7 @@ class HotRunner extends ResidentRunner {
}
@override
Future
<
Null
>
handleTerminalCommand
(
String
code
)
async
{
Future
<
void
>
handleTerminalCommand
(
String
code
)
async
{
final
String
lower
=
code
.
toLowerCase
();
if
(
lower
==
'r'
)
{
final
OperationResult
result
=
await
restart
(
fullRestart:
code
==
'R'
);
...
...
@@ -340,7 +340,7 @@ class HotRunner extends ResidentRunner {
return
true
;
}
Future
<
Null
>
_evictDirtyAssets
()
async
{
Future
<
void
>
_evictDirtyAssets
()
async
{
for
(
FlutterDevice
device
in
flutterDevices
)
{
if
(
device
.
devFS
.
assetPathsToEvict
.
isEmpty
)
return
;
...
...
@@ -357,7 +357,7 @@ class HotRunner extends ResidentRunner {
device
.
devFS
.
assetPathsToEvict
.
clear
();
}
Future
<
Null
>
_cleanupDevFS
()
async
{
Future
<
void
>
_cleanupDevFS
()
async
{
for
(
FlutterDevice
device
in
flutterDevices
)
{
if
(
device
.
devFS
!=
null
)
{
// Cleanup the devFS; don't wait indefinitely, and ignore any errors.
...
...
@@ -371,7 +371,7 @@ class HotRunner extends ResidentRunner {
}
}
Future
<
Null
>
_launchInView
(
FlutterDevice
device
,
Future
<
void
>
_launchInView
(
FlutterDevice
device
,
Uri
entryUri
,
Uri
packagesUri
,
Uri
assetsDirectoryUri
)
async
{
...
...
@@ -379,7 +379,7 @@ class HotRunner extends ResidentRunner {
await
view
.
runFromSource
(
entryUri
,
packagesUri
,
assetsDirectoryUri
);
}
Future
<
Null
>
_launchFromDevFS
(
String
mainScript
)
async
{
Future
<
void
>
_launchFromDevFS
(
String
mainScript
)
async
{
final
String
entryUri
=
fs
.
path
.
relative
(
mainScript
,
from:
projectRootPath
);
for
(
FlutterDevice
device
in
flutterDevices
)
{
final
Uri
deviceEntryUri
=
device
.
devFS
.
baseUri
.
resolveUri
(
...
...
@@ -764,7 +764,7 @@ class HotRunner extends ResidentRunner {
}
@override
Future
<
Null
>
cleanupAfterSignal
()
async
{
Future
<
void
>
cleanupAfterSignal
()
async
{
await
stopEchoingDeviceLog
();
if
(
_didAttach
)
{
appFinished
();
...
...
@@ -774,10 +774,10 @@ class HotRunner extends ResidentRunner {
}
@override
Future
<
Null
>
preStop
()
=>
_cleanupDevFS
();
Future
<
void
>
preStop
()
=>
_cleanupDevFS
();
@override
Future
<
Null
>
cleanupAtFinish
()
async
{
Future
<
void
>
cleanupAtFinish
()
async
{
await
_cleanupDevFS
();
await
stopEchoingDeviceLog
();
}
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/runner/flutter_command.dart
View file @
2d3ff10d
...
...
@@ -65,7 +65,7 @@ class FlutterOptions {
static
const
String
kFileSystemScheme
=
'filesystem-scheme'
;
}
abstract
class
FlutterCommand
extends
Command
<
Null
>
{
abstract
class
FlutterCommand
extends
Command
<
void
>
{
/// The currently executing command (or sub-command).
///
/// Will be `null` until the top-most command has begun execution.
...
...
@@ -294,10 +294,10 @@ abstract class FlutterCommand extends Command<Null> {
/// and [runCommand] to execute the command
/// so that this method can record and report the overall time to analytics.
@override
Future
<
Null
>
run
()
{
Future
<
void
>
run
()
{
final
DateTime
startTime
=
clock
.
now
();
return
context
.
run
<
Null
>(
return
context
.
run
<
void
>(
name:
'command'
,
overrides:
<
Type
,
Generator
>{
FlutterCommand:
()
=>
this
},
body:
()
async
{
...
...
@@ -451,7 +451,7 @@ abstract class FlutterCommand extends Command<Null> {
@protected
@mustCallSuper
Future
<
Null
>
validateCommand
()
async
{
Future
<
void
>
validateCommand
()
async
{
if
(
_requiresPubspecYaml
&&
!
PackageMap
.
isUsingCustomPackagesPath
)
{
// Don't expect a pubspec.yaml file if the user passed in an explicit .packages file path.
if
(!
fs
.
isFileSync
(
'pubspec.yaml'
))
{
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/runner/flutter_command_runner.dart
View file @
2d3ff10d
...
...
@@ -38,7 +38,7 @@ const String kSnapshotFileName = 'flutter_tools.snapshot'; // in //flutter/bin/c
const
String
kFlutterToolsScriptFileName
=
'flutter_tools.dart'
;
// in //flutter/packages/flutter_tools/bin/
const
String
kFlutterEnginePackageName
=
'sky_engine'
;
class
FlutterCommandRunner
extends
CommandRunner
<
Null
>
{
class
FlutterCommandRunner
extends
CommandRunner
<
void
>
{
FlutterCommandRunner
({
bool
verboseHelp
=
false
})
:
super
(
'flutter'
,
'Manage your Flutter app development.
\n
'
...
...
@@ -191,7 +191,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
usageException
(
error
.
message
);
}
Command
<
Null
>
command
=
commands
[
error
.
commands
.
first
];
Command
<
void
>
command
=
commands
[
error
.
commands
.
first
];
for
(
String
commandName
in
error
.
commands
.
skip
(
1
))
{
command
=
command
.
subcommands
[
commandName
];
}
...
...
@@ -202,7 +202,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
}
@override
Future
<
Null
>
run
(
Iterable
<
String
>
args
)
{
Future
<
void
>
run
(
Iterable
<
String
>
args
)
{
// Have an invocation of 'build' print out it's sub-commands.
// TODO(ianh): Move this to the Build command itself somehow.
if
(
args
.
length
==
1
&&
args
.
first
==
'build'
)
...
...
@@ -212,7 +212,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
}
@override
Future
<
Null
>
runCommand
(
ArgResults
topLevelResults
)
async
{
Future
<
void
>
runCommand
(
ArgResults
topLevelResults
)
async
{
final
Map
<
Type
,
dynamic
>
contextOverrides
=
<
Type
,
dynamic
>{
Flags:
Flags
(
topLevelResults
),
};
...
...
@@ -300,7 +300,7 @@ class FlutterCommandRunner extends CommandRunner<Null> {
});
}
await
context
.
run
<
Null
>(
await
context
.
run
<
void
>(
overrides:
contextOverrides
.
map
<
Type
,
Generator
>((
Type
type
,
dynamic
value
)
{
return
MapEntry
<
Type
,
Generator
>(
type
,
()
=>
value
);
}),
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/services.dart
View file @
2d3ff10d
...
...
@@ -25,7 +25,7 @@ dynamic _loadYamlFile(String path) {
/// Loads all services specified in `pubspec.yaml`. Parses each service config file,
/// storing meta data in [services] and the list of jar files in [jars].
Future
<
Null
>
parseServiceConfigs
(
Future
<
void
>
parseServiceConfigs
(
List
<
Map
<
String
,
String
>>
services
,
{
List
<
File
>
jars
}
)
async
{
Map
<
String
,
Uri
>
packageMap
;
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/test/coverage_collector.dart
View file @
2d3ff10d
...
...
@@ -40,7 +40,7 @@ class CoverageCollector extends TestWatcher {
/// has been run to completion so that all coverage data has been recorded.
///
/// The returned [Future] completes when the coverage is collected.
Future
<
Null
>
collectCoverage
(
Process
process
,
Uri
observatoryUri
)
async
{
Future
<
void
>
collectCoverage
(
Process
process
,
Uri
observatoryUri
)
async
{
assert
(
process
!=
null
);
assert
(
observatoryUri
!=
null
);
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/test/flutter_platform.dart
View file @
2d3ff10d
...
...
@@ -190,7 +190,7 @@ void main() {
enum
_InitialResult
{
crashed
,
timedOut
,
connected
}
enum
_TestResult
{
crashed
,
harnessBailed
,
testBailed
}
typedef
_Finalizer
=
Future
<
Null
>
Function
();
typedef
_Finalizer
=
Future
<
void
>
Function
();
class
_CompilationRequest
{
_CompilationRequest
(
this
.
path
,
this
.
result
);
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/tester/flutter_tester.dart
View file @
2d3ff10d
...
...
@@ -246,5 +246,5 @@ class _NoopPortForwarder extends DevicePortForwarder {
List
<
ForwardedPort
>
get
forwardedPorts
=>
<
ForwardedPort
>[];
@override
Future
<
Null
>
unforward
(
ForwardedPort
forwardedPort
)
=>
null
;
Future
<
void
>
unforward
(
ForwardedPort
forwardedPort
)
=>
null
;
}
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/tracing.dart
View file @
2d3ff10d
...
...
@@ -25,7 +25,7 @@ class Tracing {
final
VMService
vmService
;
Future
<
Null
>
startTracing
()
async
{
Future
<
void
>
startTracing
()
async
{
await
vmService
.
vm
.
setVMTimelineFlags
(<
String
>[
'Compiler'
,
'Dart'
,
'Embedder'
,
'GC'
]);
await
vmService
.
vm
.
clearVMTimeline
();
}
...
...
@@ -41,7 +41,7 @@ class Tracing {
await
vmService
.
vm
.
setVMTimelineFlags
(<
String
>[]);
timeline
=
await
vmService
.
vm
.
getVMTimeline
();
}
else
{
final
Completer
<
Null
>
whenFirstFrameRendered
=
Completer
<
Null
>();
final
Completer
<
void
>
whenFirstFrameRendered
=
Completer
<
void
>();
(
await
vmService
.
onTimelineEvent
).
listen
((
ServiceEvent
timelineEvent
)
{
final
List
<
Map
<
String
,
dynamic
>>
events
=
timelineEvent
.
timelineEvents
;
...
...
@@ -74,7 +74,7 @@ class Tracing {
/// Download the startup trace information from the given observatory client and
/// store it to build/start_up_info.json.
Future
<
Null
>
downloadStartupTrace
(
VMService
observatory
)
async
{
Future
<
void
>
downloadStartupTrace
(
VMService
observatory
)
async
{
final
String
traceInfoFilePath
=
fs
.
path
.
join
(
getBuildDirectory
(),
'start_up_info.json'
);
final
File
traceInfoFile
=
fs
.
file
(
traceInfoFilePath
);
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/usage.dart
View file @
2d3ff10d
...
...
@@ -122,7 +122,7 @@ class Usage {
/// Returns when the last analytics event has been sent, or after a fixed
/// (short) delay, whichever is less.
Future
<
Null
>
ensureAnalyticsSent
()
async
{
Future
<
void
>
ensureAnalyticsSent
()
async
{
// TODO(devoncarew): This may delay tool exit and could cause some analytics
// events to not be reported. Perhaps we could send the analytics pings
// out-of-process from flutter_tools?
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/version.dart
View file @
2d3ff10d
...
...
@@ -158,7 +158,7 @@ class FlutterVersion {
}
}
static
Future
<
Null
>
_removeVersionCheckRemoteIfExists
()
async
{
static
Future
<
void
>
_removeVersionCheckRemoteIfExists
()
async
{
final
List
<
String
>
remotes
=
(
await
_run
(<
String
>[
'git'
,
'remote'
]))
.
split
(
'
\n
'
)
.
map
<
String
>((
String
name
)
=>
name
.
trim
())
// to account for OS-specific line-breaks
...
...
@@ -234,7 +234,7 @@ class FlutterVersion {
/// [checkFlutterVersionFreshness] is called after this. This is typically
/// used when switching channels so that stale information from another
/// channel doesn't linger.
static
Future
<
Null
>
resetFlutterVersionFreshnessCheck
()
async
{
static
Future
<
void
>
resetFlutterVersionFreshnessCheck
()
async
{
try
{
await
Cache
.
instance
.
getStampFileFor
(
VersionCheckStamp
.
kFlutterVersionCheckStampFile
,
...
...
@@ -249,7 +249,7 @@ class FlutterVersion {
///
/// This function must run while [Cache.lock] is acquired because it reads and
/// writes shared cache files.
Future
<
Null
>
checkFlutterVersionFreshness
()
async
{
Future
<
void
>
checkFlutterVersionFreshness
()
async
{
// Don't perform update checks if we're not on an official channel.
if
(!
officialChannels
.
contains
(
_channel
))
{
return
;
...
...
@@ -288,11 +288,11 @@ class FlutterVersion {
?
newVersionAvailableMessage
()
:
versionOutOfDateMessage
(
frameworkAge
);
printStatus
(
updateMessage
,
emphasis:
true
);
await
Future
.
wait
<
Null
>(<
Future
<
Null
>>[
await
Future
.
wait
<
void
>(<
Future
<
void
>>[
stamp
.
store
(
newTimeWarningWasPrinted:
_clock
.
now
(),
),
Future
<
Null
>.
delayed
(
timeToPauseToLetUserReadTheMessage
),
Future
<
void
>.
delayed
(
timeToPauseToLetUserReadTheMessage
),
]);
}
}
...
...
@@ -418,7 +418,7 @@ class VersionCheckStamp {
);
}
Future
<
Null
>
store
({
Future
<
void
>
store
({
DateTime
newTimeVersionWasChecked
,
DateTime
newKnownRemoteVersion
,
DateTime
newTimeWarningWasPrinted
,
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/vmservice.dart
View file @
2d3ff10d
...
...
@@ -37,7 +37,7 @@ _OpenChannel _openChannel = _defaultOpenChannel;
/// hot mode.
///
/// See: https://github.com/dart-lang/sdk/issues/30023
typedef
ReloadSources
=
Future
<
Null
>
Function
(
typedef
ReloadSources
=
Future
<
void
>
Function
(
String
isolateId
,
{
bool
force
,
bool
pause
,
...
...
@@ -66,7 +66,7 @@ Future<StreamChannel<String>> _defaultOpenChannel(Uri uri) async {
printTrace
(
'This was attempt #
$attempts
. Will retry in
$delay
.'
);
// Delay next attempt.
await
Future
<
Null
>.
delayed
(
delay
);
await
Future
<
void
>.
delayed
(
delay
);
// Back off exponentially.
delay
*=
2
;
...
...
@@ -260,7 +260,7 @@ class VMService {
/// Whether our connection to the VM service has been closed;
bool
get
isClosed
=>
_peer
.
isClosed
;
Future
<
Null
>
get
done
async
{
Future
<
void
>
get
done
async
{
await
_peer
.
done
;
}
...
...
@@ -332,7 +332,7 @@ class VMService {
_getEventController
(
streamId
).
add
(
event
);
}
Future
<
Null
>
_streamListen
(
String
streamId
)
async
{
Future
<
void
>
_streamListen
(
String
streamId
)
async
{
if
(!
_listeningFor
.
contains
(
streamId
))
{
_listeningFor
.
add
(
streamId
);
await
_sendRequest
(
'streamListen'
,
<
String
,
dynamic
>{
'streamId'
:
streamId
});
...
...
@@ -344,7 +344,7 @@ class VMService {
return
await
_vm
.
reload
();
}
Future
<
Null
>
refreshViews
()
async
{
Future
<
void
>
refreshViews
()
async
{
if
(!
vm
.
isFlutterEngine
)
return
;
await
vm
.
refreshViews
();
...
...
@@ -948,7 +948,7 @@ class VM extends ServiceObjectOwner {
return
invokeRpcRaw
(
'_getVMTimeline'
,
timeout:
kLongRequestTimeout
);
}
Future
<
Null
>
refreshViews
()
async
{
Future
<
void
>
refreshViews
()
async
{
if
(!
isFlutterEngine
)
return
;
_viewCache
.
clear
();
...
...
@@ -1277,7 +1277,7 @@ class Isolate extends ServiceObjectOwner {
Future
<
Map
<
String
,
dynamic
>>
flutterToggleWidgetInspector
()
=>
_flutterToggle
(
'inspector.show'
);
Future
<
Null
>
flutterDebugAllowBanner
(
bool
show
)
async
{
Future
<
void
>
flutterDebugAllowBanner
(
bool
show
)
async
{
await
invokeFlutterExtensionRpcRaw
(
'ext.flutter.debugAllowBanner'
,
params:
<
String
,
dynamic
>{
'enabled'
:
show
?
'true'
:
'false'
},
...
...
@@ -1412,12 +1412,12 @@ class FlutterView extends ServiceObject {
}
// TODO(johnmccutchan): Report errors when running failed.
Future
<
Null
>
runFromSource
(
Uri
entryUri
,
Future
<
void
>
runFromSource
(
Uri
entryUri
,
Uri
packagesUri
,
Uri
assetsDirectoryUri
)
async
{
final
String
viewId
=
id
;
// When this completer completes the isolate is running.
final
Completer
<
Null
>
completer
=
Completer
<
Null
>();
final
Completer
<
void
>
completer
=
Completer
<
void
>();
final
StreamSubscription
<
ServiceEvent
>
subscription
=
(
await
owner
.
vm
.
vmService
.
onIsolateEvent
).
listen
((
ServiceEvent
event
)
{
// TODO(johnmccutchan): Listen to the debug stream and catch initial
...
...
@@ -1425,7 +1425,7 @@ class FlutterView extends ServiceObject {
if
(
event
.
kind
==
ServiceEvent
.
kIsolateRunnable
)
{
printTrace
(
'Isolate is runnable.'
);
if
(!
completer
.
isCompleted
)
completer
.
complete
(
null
);
completer
.
complete
();
}
});
await
owner
.
vm
.
runInView
(
viewId
,
...
...
@@ -1437,7 +1437,7 @@ class FlutterView extends ServiceObject {
await
subscription
.
cancel
();
}
Future
<
Null
>
setAssetDirectory
(
Uri
assetsDirectory
)
async
{
Future
<
void
>
setAssetDirectory
(
Uri
assetsDirectory
)
async
{
assert
(
assetsDirectory
!=
null
);
await
owner
.
vmService
.
vm
.
invokeRpc
<
ServiceObject
>(
'_flutter.setAssetBundlePath'
,
params:
<
String
,
dynamic
>{
...
...
@@ -1449,7 +1449,7 @@ class FlutterView extends ServiceObject {
bool
get
hasIsolate
=>
_uiIsolate
!=
null
;
Future
<
Null
>
flushUIThreadTasks
()
async
{
Future
<
void
>
flushUIThreadTasks
()
async
{
await
owner
.
vm
.
invokeRpcRaw
(
'_flutter.flushUIThreadTasks'
,
params:
<
String
,
dynamic
>{
'isolateId'
:
_uiIsolate
.
id
});
}
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/lib/src/vmservice_record_replay.dart
View file @
2d3ff10d
...
...
@@ -253,7 +253,7 @@ class _ReplaySink implements StreamSink<String> {
_ReplaySink
(
this
.
channel
);
final
ReplayVMServiceChannel
channel
;
final
Completer
<
Null
>
_completer
=
Completer
<
Null
>();
final
Completer
<
void
>
_completer
=
Completer
<
void
>();
@override
Future
<
dynamic
>
close
()
{
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/analytics_test.dart
View file @
2d3ff10d
...
...
@@ -52,7 +52,7 @@ void main() {
count
=
0
;
flutterUsage
.
enabled
=
false
;
final
DoctorCommand
doctorCommand
=
DoctorCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
doctorCommand
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
doctorCommand
);
await
runner
.
run
(<
String
>[
'doctor'
]);
expect
(
count
,
0
);
},
overrides:
<
Type
,
Generator
>{
...
...
@@ -67,7 +67,7 @@ void main() {
flutterUsage
.
enabled
=
false
;
final
ConfigCommand
command
=
ConfigCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'config'
]);
expect
(
count
,
0
);
...
...
@@ -100,7 +100,7 @@ void main() {
mockTimes
=
<
int
>[
1000
,
2000
];
when
(
mockDoctor
.
diagnose
(
androidLicenses:
false
,
verbose:
false
)).
thenAnswer
((
_
)
async
=>
true
);
final
DoctorCommand
command
=
DoctorCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'doctor'
]);
verify
(
mockClock
.
now
()).
called
(
2
);
...
...
@@ -119,7 +119,7 @@ void main() {
mockTimes
=
<
int
>[
1000
,
2000
];
when
(
mockDoctor
.
diagnose
(
androidLicenses:
false
,
verbose:
false
)).
thenAnswer
((
_
)
async
=>
false
);
final
DoctorCommand
command
=
DoctorCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'doctor'
]);
verify
(
mockClock
.
now
()).
called
(
2
);
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/asset_bundle_package_fonts_test.dart
View file @
2d3ff10d
...
...
@@ -60,7 +60,7 @@ $fontsSection
..
writeAsStringSync
(
packages
);
}
Future
<
Null
>
buildAndVerifyFonts
(
Future
<
void
>
buildAndVerifyFonts
(
List
<
String
>
localFonts
,
List
<
String
>
packageFonts
,
List
<
String
>
packages
,
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/asset_bundle_package_test.dart
View file @
2d3ff10d
...
...
@@ -66,7 +66,7 @@ $assetsSection
..
writeAsStringSync
(
packages
);
}
Future
<
Null
>
buildAndVerifyAssets
(
Future
<
void
>
buildAndVerifyAssets
(
List
<
String
>
assets
,
List
<
String
>
packages
,
String
expectedAssetManifest
,
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/base/flags_test.dart
View file @
2d3ff10d
...
...
@@ -11,12 +11,12 @@ import 'package:flutter_tools/src/runner/flutter_command.dart';
import
'../src/common.dart'
;
import
'../src/context.dart'
;
typedef
_TestMethod
=
FutureOr
<
Null
>
Function
();
typedef
_TestMethod
=
FutureOr
<
void
>
Function
();
void
main
(
)
{
Cache
.
disableLocking
();
Future
<
Null
>
runCommand
(
Iterable
<
String
>
flags
,
_TestMethod
testMethod
)
async
{
Future
<
void
>
runCommand
(
Iterable
<
String
>
flags
,
_TestMethod
testMethod
)
async
{
final
List
<
String
>
args
=
<
String
>[
'test'
]..
addAll
(
flags
);
final
_TestCommand
command
=
_TestCommand
(
testMethod
);
await
createTestCommandRunner
(
command
).
run
(
args
);
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/channel_test.dart
View file @
2d3ff10d
...
...
@@ -43,7 +43,7 @@ void main() {
testUsingContext
(
'list'
,
()
async
{
final
ChannelCommand
command
=
ChannelCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'channel'
]);
expect
(
testLogger
.
errorText
,
hasLength
(
0
));
// The bots may return an empty list of channels (network hiccup?)
...
...
@@ -65,7 +65,7 @@ void main() {
)).
thenAnswer
((
_
)
=>
Future
<
Process
>.
value
(
process
));
final
ChannelCommand
command
=
ChannelCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'channel'
]);
verify
(
mockProcessManager
.
start
(
...
...
@@ -106,7 +106,7 @@ void main() {
)).
thenAnswer
((
_
)
=>
Future
<
Process
>.
value
(
createMockProcess
()));
final
ChannelCommand
command
=
ChannelCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'channel'
,
'beta'
]);
verify
(
mockProcessManager
.
start
(
...
...
@@ -166,7 +166,7 @@ void main() {
'''
);
final
ChannelCommand
command
=
ChannelCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'channel'
,
'beta'
]);
verify
(
mockProcessManager
.
start
(
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/commands/analyze_once_test.dart
View file @
2d3ff10d
...
...
@@ -191,7 +191,7 @@ void assertContains(String text, List<String> patterns) {
}
}
Future
<
Null
>
runCommand
({
Future
<
void
>
runCommand
({
FlutterCommand
command
,
List
<
String
>
arguments
,
List
<
String
>
statusTextContains
,
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/commands/create_test.dart
View file @
2d3ff10d
...
...
@@ -234,7 +234,7 @@ void main() {
when
(
mockFlutterVersion
.
channel
).
thenReturn
(
frameworkChannel
);
final
CreateCommand
command
=
CreateCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'create'
,
'--template=application'
,
'--no-pub'
,
'--org'
,
'com.foo.bar'
,
projectDir
.
path
]);
...
...
@@ -305,7 +305,7 @@ void main() {
when
(
mockFlutterVersion
.
channel
).
thenReturn
(
frameworkChannel
);
final
CreateCommand
command
=
CreateCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'create'
,
'--template=app'
,
'--no-pub'
,
'--org'
,
'com.foo.bar'
,
projectDir
.
path
]);
...
...
@@ -374,7 +374,7 @@ void main() {
Cache
.
flutterRoot
=
'../..'
;
final
CreateCommand
command
=
CreateCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'create'
,
'--no-pub'
,
projectDir
.
path
]);
...
...
@@ -385,7 +385,7 @@ void main() {
Cache
.
flutterRoot
=
'../..'
;
final
CreateCommand
command
=
CreateCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'create'
,
'--no-pub'
,
'--template=app'
,
projectDir
.
path
]);
...
...
@@ -402,7 +402,7 @@ void main() {
Cache
.
flutterRoot
=
'../..'
;
final
CreateCommand
command
=
CreateCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'create'
,
'--no-pub'
,
'--template=app'
,
projectDir
.
path
]);
...
...
@@ -416,7 +416,7 @@ void main() {
Cache
.
flutterRoot
=
'../..'
;
final
CreateCommand
command
=
CreateCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'create'
,
'--no-pub'
,
'--template=plugin'
,
projectDir
.
path
]);
...
...
@@ -430,7 +430,7 @@ void main() {
Cache
.
flutterRoot
=
'../..'
;
final
CreateCommand
command
=
CreateCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'create'
,
'--no-pub'
,
'--template=package'
,
projectDir
.
path
]);
...
...
@@ -555,7 +555,7 @@ void main() {
Cache
.
flutterRoot
=
'../..'
;
final
CreateCommand
command
=
CreateCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
expect
(
runner
.
run
(<
String
>[
'create'
,
projectDir
.
path
,
'--pub'
]),
...
...
@@ -567,7 +567,7 @@ void main() {
testUsingContext
(
'fails when file exists'
,
()
async
{
Cache
.
flutterRoot
=
'../..'
;
final
CreateCommand
command
=
CreateCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
final
File
existingFile
=
fs
.
file
(
'
${projectDir.path.toString()}
/bad'
);
if
(!
existingFile
.
existsSync
())
{
existingFile
.
createSync
(
recursive:
true
);
...
...
@@ -581,7 +581,7 @@ void main() {
testUsingContext
(
'fails when invalid package name'
,
()
async
{
Cache
.
flutterRoot
=
'../..'
;
final
CreateCommand
command
=
CreateCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
expect
(
runner
.
run
(<
String
>[
'create'
,
fs
.
path
.
join
(
projectDir
.
path
,
'invalidName'
)]),
throwsToolExit
(
message:
'"invalidName" is not a valid Dart package name.'
),
...
...
@@ -594,7 +594,7 @@ void main() {
Cache
.
flutterRoot
=
'../..'
;
final
CreateCommand
command
=
CreateCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'create'
,
'--pub'
,
'--offline'
,
projectDir
.
path
]);
expect
(
loggingProcessManager
.
commands
.
first
,
contains
(
matches
(
r'dart-sdk[\\/]bin[\\/]pub'
)));
...
...
@@ -612,7 +612,7 @@ void main() {
Cache
.
flutterRoot
=
'../..'
;
final
CreateCommand
command
=
CreateCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'create'
,
'--pub'
,
projectDir
.
path
]);
expect
(
loggingProcessManager
.
commands
.
first
,
contains
(
matches
(
r'dart-sdk[\\/]bin[\\/]pub'
)));
...
...
@@ -625,7 +625,7 @@ void main() {
);
}
Future
<
Null
>
_createProject
(
Future
<
void
>
_createProject
(
Directory
dir
,
List
<
String
>
createArgs
,
List
<
String
>
expectedPaths
,
{
...
...
@@ -633,7 +633,7 @@ Future<Null> _createProject(
})
async
{
Cache
.
flutterRoot
=
'../..'
;
final
CreateCommand
command
=
CreateCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
final
List
<
String
>
args
=
<
String
>[
'create'
];
args
.
addAll
(
createArgs
);
args
.
add
(
dir
.
path
);
...
...
@@ -658,7 +658,7 @@ Future<Null> _createProject(
expect
(
failures
,
isEmpty
,
reason:
failures
.
join
(
'
\n
'
));
}
Future
<
Null
>
_createAndAnalyzeProject
(
Future
<
void
>
_createAndAnalyzeProject
(
Directory
dir
,
List
<
String
>
createArgs
,
List
<
String
>
expectedPaths
,
{
...
...
@@ -668,7 +668,7 @@ Future<Null> _createAndAnalyzeProject(
await
_analyzeProject
(
dir
.
path
);
}
Future
<
Null
>
_analyzeProject
(
String
workingDir
)
async
{
Future
<
void
>
_analyzeProject
(
String
workingDir
)
async
{
final
String
flutterToolsPath
=
fs
.
path
.
absolute
(
fs
.
path
.
join
(
'bin'
,
'flutter_tools.dart'
,
...
...
@@ -691,7 +691,7 @@ Future<Null> _analyzeProject(String workingDir) async {
expect
(
exec
.
exitCode
,
0
);
}
Future
<
Null
>
_runFlutterTest
(
Directory
workingDir
,
{
String
target
})
async
{
Future
<
void
>
_runFlutterTest
(
Directory
workingDir
,
{
String
target
})
async
{
final
String
flutterToolsPath
=
fs
.
path
.
absolute
(
fs
.
path
.
join
(
'bin'
,
'flutter_tools.dart'
,
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/commands/daemon_test.dart
View file @
2d3ff10d
...
...
@@ -84,7 +84,7 @@ void main() {
);
printStatus
(
'daemon.logMessage test'
);
// Service the event loop.
await
Future
<
Null
>.
value
();
await
Future
<
void
>.
value
();
},
zoneSpecification:
ZoneSpecification
(
print:
(
Zone
self
,
ZoneDelegate
parent
,
Zone
zone
,
String
line
)
{
buffer
.
writeln
(
line
);
}));
...
...
@@ -103,7 +103,7 @@ void main() {
notifyingLogger:
notifyingLogger
);
commands
.
add
(<
String
,
dynamic
>{
'id'
:
0
,
'method'
:
'daemon.shutdown'
});
return
daemon
.
onExit
.
then
<
Null
>((
int
code
)
async
{
return
daemon
.
onExit
.
then
<
void
>((
int
code
)
async
{
await
commands
.
close
();
expect
(
code
,
0
);
});
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/commands/format_test.dart
View file @
2d3ff10d
...
...
@@ -31,7 +31,7 @@ void main() {
srcFile
.
writeAsStringSync
(
original
.
replaceFirst
(
'main()'
,
'main( )'
));
final
FormatCommand
command
=
FormatCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'format'
,
srcFile
.
path
]);
final
String
formatted
=
srcFile
.
readAsStringSync
();
...
...
@@ -48,7 +48,7 @@ void main() {
srcFile
.
writeAsStringSync
(
nonFormatted
);
final
FormatCommand
command
=
FormatCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'format'
,
'--dry-run'
,
srcFile
.
path
]);
final
String
shouldNotFormatted
=
srcFile
.
readAsStringSync
();
...
...
@@ -65,7 +65,7 @@ void main() {
srcFile
.
writeAsStringSync
(
nonFormatted
);
final
FormatCommand
command
=
FormatCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
expect
(
runner
.
run
(<
String
>[
'format'
,
'--dry-run'
,
'--set-exit-if-changed'
,
srcFile
.
path
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/commands/ide_config_test.dart
View file @
2d3ff10d
...
...
@@ -76,7 +76,7 @@ void main() {
return
fs
.
file
(
absPath
).
existsSync
()
||
fs
.
directory
(
absPath
).
existsSync
();
}
Future
<
Null
>
_updateIdeConfig
({
Future
<
void
>
_updateIdeConfig
({
Directory
dir
,
List
<
String
>
args
=
const
<
String
>[],
Map
<
String
,
String
>
expectedContents
=
const
<
String
,
String
>{},
...
...
@@ -84,7 +84,7 @@ void main() {
})
async
{
dir
??=
tempDir
;
final
IdeConfigCommand
command
=
IdeConfigCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
final
List
<
String
>
finalArgs
=
<
String
>[
'--flutter-root=
${tempDir.absolute.path}
'
,
'ide-config'
];
finalArgs
.
addAll
(
args
);
await
runner
.
run
(
finalArgs
);
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/commands/packages_test.dart
View file @
2d3ff10d
...
...
@@ -57,9 +57,9 @@ void main() {
return
projectPath
;
}
Future
<
Null
>
runCommandIn
(
String
projectPath
,
String
verb
,
{
List
<
String
>
args
})
async
{
Future
<
void
>
runCommandIn
(
String
projectPath
,
String
verb
,
{
List
<
String
>
args
})
async
{
final
PackagesCommand
command
=
PackagesCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
final
List
<
String
>
commandArgs
=
<
String
>[
'packages'
,
verb
];
if
(
args
!=
null
)
...
...
@@ -307,12 +307,12 @@ void main() {
testUsingContext
(
'publish'
,
()
async
{
final
PromptingProcess
process
=
PromptingProcess
();
mockProcessManager
.
processFactory
=
(
List
<
String
>
commands
)
=>
process
;
final
Future
<
Null
>
runPackages
=
createTestCommandRunner
(
PackagesCommand
()).
run
(<
String
>[
'packages'
,
'pub'
,
'publish'
]);
final
Future
<
Null
>
runPrompt
=
process
.
showPrompt
(
'Proceed (y/n)? '
,
<
String
>[
'hello'
,
'world'
]);
final
Future
<
Null
>
simulateUserInput
=
Future
<
Null
>(()
{
final
Future
<
void
>
runPackages
=
createTestCommandRunner
(
PackagesCommand
()).
run
(<
String
>[
'packages'
,
'pub'
,
'publish'
]);
final
Future
<
void
>
runPrompt
=
process
.
showPrompt
(
'Proceed (y/n)? '
,
<
String
>[
'hello'
,
'world'
]);
final
Future
<
void
>
simulateUserInput
=
Future
<
void
>(()
{
mockStdio
.
simulateStdin
(
'y'
);
});
await
Future
.
wait
<
Null
>(<
Future
<
Null
>>[
runPackages
,
runPrompt
,
simulateUserInput
]);
await
Future
.
wait
<
void
>(<
Future
<
void
>>[
runPackages
,
runPrompt
,
simulateUserInput
]);
final
List
<
String
>
commands
=
mockProcessManager
.
commands
;
expect
(
commands
,
hasLength
(
2
));
expect
(
commands
[
0
],
matches
(
r'dart-sdk[\\/]bin[\\/]pub'
));
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/commands/test_test.dart
View file @
2d3ff10d
...
...
@@ -15,7 +15,7 @@ import '../src/context.dart';
// This test depends on some files in ///dev/automated_tests/flutter_test/*
Future
<
Null
>
_testExclusionLock
;
Future
<
void
>
_testExclusionLock
;
void
main
(
)
{
group
(
'flutter test should'
,
()
{
...
...
@@ -90,7 +90,7 @@ void main() {
});
}
Future
<
Null
>
_testFile
(
String
testName
,
String
workingDirectory
,
String
testDirectory
,
{
Matcher
exitCode
})
async
{
Future
<
void
>
_testFile
(
String
testName
,
String
workingDirectory
,
String
testDirectory
,
{
Matcher
exitCode
})
async
{
exitCode
??=
isNonZero
;
final
String
fullTestExpectation
=
fs
.
path
.
join
(
testDirectory
,
'
${testName}
_expectation.txt'
);
final
File
expectationFile
=
fs
.
file
(
fullTestExpectation
);
...
...
@@ -171,7 +171,7 @@ Future<ProcessResult> _runFlutterTest(
while
(
_testExclusionLock
!=
null
)
await
_testExclusionLock
;
final
Completer
<
Null
>
testExclusionCompleter
=
Completer
<
Null
>();
final
Completer
<
void
>
testExclusionCompleter
=
Completer
<
void
>();
_testExclusionLock
=
testExclusionCompleter
.
future
;
try
{
return
await
Process
.
run
(
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/compile_test.dart
View file @
2d3ff10d
...
...
@@ -376,7 +376,7 @@ void main() {
});
}
Future
<
Null
>
_recompile
(
StreamController
<
List
<
int
>>
streamController
,
Future
<
void
>
_recompile
(
StreamController
<
List
<
int
>>
streamController
,
ResidentCompiler
generator
,
MockStdIn
mockFrontendServerStdIn
,
String
mockCompilerOutput
)
async
{
// Put content into the output stream after generator.recompile gets
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/crash_reporting_test.dart
View file @
2d3ff10d
...
...
@@ -173,7 +173,7 @@ class _CrashCommand extends FlutterCommand {
String
get
name
=>
'crash'
;
@override
Future
<
Null
>
runCommand
()
async
{
Future
<
FlutterCommandResult
>
runCommand
()
async
{
void
fn1
()
{
throw
StateError
(
'Test bad state error'
);
}
...
...
@@ -187,6 +187,8 @@ class _CrashCommand extends FlutterCommand {
}
fn3
();
return
null
;
}
}
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/dart/pub_get_test.dart
View file @
2d3ff10d
...
...
@@ -32,7 +32,7 @@ void main() {
FakeAsync
().
run
((
FakeAsync
time
)
{
expect
(
processMock
.
lastPubEnvironment
,
isNull
);
expect
(
testLogger
.
statusText
,
''
);
pubGet
(
context:
PubContext
.
flutterTests
,
checkLastModified:
false
).
then
((
Null
value
)
{
pubGet
(
context:
PubContext
.
flutterTests
,
checkLastModified:
false
).
then
((
void
value
)
{
error
=
'test completed unexpectedly'
;
},
onError:
(
dynamic
thrownError
)
{
error
=
'test failed unexpectedly:
$thrownError
'
;
...
...
@@ -102,7 +102,7 @@ void main() {
MockDirectory
.
findCache
=
true
;
expect
(
processMock
.
lastPubEnvironment
,
isNull
);
expect
(
processMock
.
lastPubCache
,
isNull
);
pubGet
(
context:
PubContext
.
flutterTests
,
checkLastModified:
false
).
then
((
Null
value
)
{
pubGet
(
context:
PubContext
.
flutterTests
,
checkLastModified:
false
).
then
((
void
value
)
{
error
=
'test completed unexpectedly'
;
},
onError:
(
dynamic
thrownError
)
{
error
=
'test failed unexpectedly:
$thrownError
'
;
...
...
@@ -128,7 +128,7 @@ void main() {
MockDirectory
.
findCache
=
true
;
expect
(
processMock
.
lastPubEnvironment
,
isNull
);
expect
(
processMock
.
lastPubCache
,
isNull
);
pubGet
(
context:
PubContext
.
flutterTests
,
checkLastModified:
false
).
then
((
Null
value
)
{
pubGet
(
context:
PubContext
.
flutterTests
,
checkLastModified:
false
).
then
((
void
value
)
{
error
=
'test completed unexpectedly'
;
},
onError:
(
dynamic
thrownError
)
{
error
=
'test failed unexpectedly:
$thrownError
'
;
...
...
@@ -213,7 +213,7 @@ class MockStreamSubscription<T> implements StreamSubscription<T> {
Future
<
E
>
asFuture
<
E
>([
E
futureValue
])
=>
Future
<
E
>.
value
();
@override
Future
<
Null
>
cancel
()
=>
null
;
Future
<
void
>
cancel
()
=>
null
;
@override
dynamic
noSuchMethod
(
Invocation
invocation
)
=>
null
;
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/devfs_test.dart
View file @
2d3ff10d
...
...
@@ -438,7 +438,7 @@ class MockVMService extends BasicMock implements VMService {
@override
VM
get
vm
=>
_vm
;
Future
<
Null
>
setUp
()
async
{
Future
<
void
>
setUp
()
async
{
try
{
_server
=
await
HttpServer
.
bind
(
InternetAddress
.
loopbackIPv6
,
0
);
_httpAddress
=
Uri
.
parse
(
'http://[::1]:
${_server.port}
'
);
...
...
@@ -451,7 +451,7 @@ class MockVMService extends BasicMock implements VMService {
final
String
fsName
=
request
.
headers
.
value
(
'dev_fs_name'
);
final
String
devicePath
=
utf8
.
decode
(
base64
.
decode
(
request
.
headers
.
value
(
'dev_fs_uri_b64'
)));
messages
.
add
(
'writeFile
$fsName
$devicePath
'
);
request
.
drain
<
List
<
int
>>().
then
<
Null
>((
List
<
int
>
value
)
{
request
.
drain
<
List
<
int
>>().
then
<
void
>((
List
<
int
>
value
)
{
request
.
response
..
write
(
'Got it'
)
..
close
();
...
...
@@ -459,7 +459,7 @@ class MockVMService extends BasicMock implements VMService {
});
}
Future
<
Null
>
tearDown
()
async
{
Future
<
void
>
tearDown
()
async
{
await
_server
?.
close
();
}
...
...
@@ -522,7 +522,7 @@ void _cleanupTempDirs() {
tryToDelete
(
_tempDirs
.
removeLast
());
}
Future
<
Null
>
_createPackage
(
FileSystem
fs
,
String
pkgName
,
String
pkgFileName
,
{
bool
doubleSlash
=
false
})
async
{
Future
<
void
>
_createPackage
(
FileSystem
fs
,
String
pkgName
,
String
pkgFileName
,
{
bool
doubleSlash
=
false
})
async
{
final
Directory
pkgTempDir
=
_newTempDir
(
fs
);
String
pkgFilePath
=
fs
.
path
.
join
(
pkgTempDir
.
path
,
pkgName
,
'lib'
,
pkgFileName
);
if
(
doubleSlash
)
{
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/device_test.dart
View file @
2d3ff10d
...
...
@@ -25,7 +25,7 @@ void main() {
final
List
<
Device
>
devices
=
<
Device
>[
device1
,
device2
,
device3
];
final
DeviceManager
deviceManager
=
TestDeviceManager
(
devices
);
Future
<
Null
>
expectDevice
(
String
id
,
List
<
Device
>
expected
)
async
{
Future
<
void
>
expectDevice
(
String
id
,
List
<
Device
>
expected
)
async
{
expect
(
await
deviceManager
.
getDevicesById
(
id
).
toList
(),
expected
);
}
await
expectDevice
(
'01abfc49119c410e'
,
<
Device
>[
device2
]);
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/emulator_test.dart
View file @
2d3ff10d
...
...
@@ -58,7 +58,7 @@ void main() {
final
TestEmulatorManager
testEmulatorManager
=
TestEmulatorManager
(
emulators
);
Future
<
Null
>
expectEmulator
(
String
id
,
List
<
Emulator
>
expected
)
async
{
Future
<
void
>
expectEmulator
(
String
id
,
List
<
Emulator
>
expected
)
async
{
expect
(
await
testEmulatorManager
.
getEmulatorsMatching
(
id
),
expected
);
}
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/project_test.dart
View file @
2d3ff10d
...
...
@@ -234,7 +234,7 @@ void main() {
mockXcodeProjectInterpreter
=
MockXcodeProjectInterpreter
();
});
void
testWithMocks
(
String
description
,
Future
<
Null
>
testMethod
())
{
void
testWithMocks
(
String
description
,
Future
<
void
>
testMethod
())
{
testUsingContext
(
description
,
testMethod
,
overrides:
<
Type
,
Generator
>{
FileSystem:
()
=>
fs
,
IOSWorkflow:
()
=>
mockIOSWorkflow
,
...
...
@@ -365,7 +365,7 @@ flutter:
/// Executes the [testMethod] in a context where the file system
/// is in memory.
void
testInMemory
(
String
description
,
Future
<
Null
>
testMethod
())
{
void
testInMemory
(
String
description
,
Future
<
void
>
testMethod
())
{
Cache
.
flutterRoot
=
getFlutterRoot
();
final
FileSystem
testFileSystem
=
MemoryFileSystem
(
style:
platform
.
isWindows
?
FileSystemStyle
.
windows
:
FileSystemStyle
.
posix
,
...
...
@@ -406,7 +406,7 @@ void transfer(FileSystemEntity entity, FileSystem target) {
}
}
Future
<
Null
>
expectToolExitLater
(
Future
<
dynamic
>
future
,
Matcher
messageMatcher
)
async
{
Future
<
void
>
expectToolExitLater
(
Future
<
dynamic
>
future
,
Matcher
messageMatcher
)
async
{
try
{
await
future
;
fail
(
'ToolExit expected, but nothing thrown'
);
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/protocol_discovery_test.dart
View file @
2d3ff10d
...
...
@@ -240,7 +240,7 @@ class MockPortForwarder extends DevicePortForwarder {
List
<
ForwardedPort
>
get
forwardedPorts
=>
throw
'not implemented'
;
@override
Future
<
Null
>
unforward
(
ForwardedPort
forwardedPort
)
{
Future
<
void
>
unforward
(
ForwardedPort
forwardedPort
)
{
throw
'not implemented'
;
}
}
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/resident_runner_test.dart
View file @
2d3ff10d
...
...
@@ -18,13 +18,13 @@ class TestRunner extends ResidentRunner {
String
receivedCommand
;
@override
Future
<
Null
>
cleanupAfterSignal
()
=>
null
;
Future
<
void
>
cleanupAfterSignal
()
=>
null
;
@override
Future
<
Null
>
cleanupAtFinish
()
=>
null
;
Future
<
void
>
cleanupAtFinish
()
=>
null
;
@override
Future
<
Null
>
handleTerminalCommand
(
String
code
)
async
{
Future
<
void
>
handleTerminalCommand
(
String
code
)
async
{
receivedCommand
=
code
;
}
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/runner/flutter_command_test.dart
View file @
2d3ff10d
...
...
@@ -188,7 +188,7 @@ class DummyFlutterCommand extends FlutterCommand {
@override
Future
<
FlutterCommandResult
>
runCommand
()
async
{
return
commandFunction
==
null
?
null
:
commandFunction
();
return
commandFunction
==
null
?
null
:
await
commandFunction
();
}
}
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/src/common.dart
View file @
2d3ff10d
...
...
@@ -68,7 +68,7 @@ String getFlutterRoot() {
return
fs
.
path
.
normalize
(
fs
.
path
.
join
(
toolsPath
,
'..'
,
'..'
));
}
CommandRunner
<
Null
>
createTestCommandRunner
([
FlutterCommand
command
])
{
CommandRunner
<
void
>
createTestCommandRunner
([
FlutterCommand
command
])
{
final
FlutterCommandRunner
runner
=
FlutterCommandRunner
();
if
(
command
!=
null
)
runner
.
addCommand
(
command
);
...
...
@@ -113,7 +113,7 @@ Future<String> createProject(Directory temp, {List<String> arguments}) async {
arguments
??=
<
String
>[
'--no-pub'
];
final
String
projectPath
=
fs
.
path
.
join
(
temp
.
path
,
'flutter_project'
);
final
CreateCommand
command
=
CreateCommand
();
final
CommandRunner
<
Null
>
runner
=
createTestCommandRunner
(
command
);
final
CommandRunner
<
void
>
runner
=
createTestCommandRunner
(
command
);
await
runner
.
run
(<
String
>[
'create'
]..
addAll
(
arguments
)..
add
(
projectPath
));
return
projectPath
;
}
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/src/context.dart
View file @
2d3ff10d
...
...
@@ -262,7 +262,7 @@ class MockUsage implements Usage {
Stream
<
Map
<
String
,
dynamic
>>
get
onSend
=>
null
;
@override
Future
<
Null
>
ensureAnalyticsSent
()
=>
Future
<
Null
>.
value
();
Future
<
void
>
ensureAnalyticsSent
()
=>
Future
<
void
>.
value
();
@override
void
printWelcome
()
{
}
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/src/mocks.dart
View file @
2d3ff10d
...
...
@@ -173,7 +173,7 @@ class MockProcess extends Mock implements Process {
/// A process that prompts the user to proceed, then asynchronously writes
/// some lines to stdout before it exits.
class
PromptingProcess
implements
Process
{
Future
<
Null
>
showPrompt
(
String
prompt
,
List
<
String
>
outputLines
)
async
{
Future
<
void
>
showPrompt
(
String
prompt
,
List
<
String
>
outputLines
)
async
{
_stdoutController
.
add
(
utf8
.
encode
(
prompt
));
final
List
<
int
>
bytesOnStdin
=
await
_stdin
.
future
;
// Echo stdin to stdout.
...
...
@@ -234,11 +234,11 @@ class MemoryIOSink implements IOSink {
}
@override
Future
<
Null
>
addStream
(
Stream
<
List
<
int
>>
stream
)
{
final
Completer
<
Null
>
completer
=
Completer
<
Null
>();
Future
<
void
>
addStream
(
Stream
<
List
<
int
>>
stream
)
{
final
Completer
<
void
>
completer
=
Completer
<
void
>();
stream
.
listen
((
List
<
int
>
data
)
{
add
(
data
);
}).
onDone
(()
=>
completer
.
complete
(
null
));
}).
onDone
(()
=>
completer
.
complete
());
return
completer
.
future
;
}
...
...
@@ -275,13 +275,13 @@ class MemoryIOSink implements IOSink {
}
@override
Future
<
Null
>
get
done
=>
close
();
Future
<
void
>
get
done
=>
close
();
@override
Future
<
Null
>
close
()
async
=>
null
;
Future
<
void
>
close
()
async
=>
null
;
@override
Future
<
Null
>
flush
()
async
=>
null
;
Future
<
void
>
flush
()
async
=>
null
;
}
/// A Stdio that collects stdout and supports simulated stdin.
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/test/utils_test.dart
View file @
2d3ff10d
...
...
@@ -134,7 +134,7 @@ baz=qux
called
=
true
;
},
const
Duration
(
seconds:
1
));
expect
(
called
,
false
);
await
Future
<
Null
>.
delayed
(
kShortDelay
);
await
Future
<
void
>.
delayed
(
kShortDelay
);
expect
(
called
,
true
);
});
...
...
@@ -145,7 +145,7 @@ baz=qux
callCount
++;
},
Duration
(
milliseconds:
kShortDelay
.
inMilliseconds
~/
2
));
expect
(
callCount
,
0
);
await
Future
<
Null
>.
delayed
(
kShortDelay
);
await
Future
<
void
>.
delayed
(
kShortDelay
);
expect
(
callCount
,
greaterThanOrEqualTo
(
2
));
});
...
...
@@ -160,7 +160,7 @@ baz=qux
completer
.
complete
(
DateTime
.
now
().
difference
(
firstTime
));
// introduce a delay
await
Future
<
Null
>.
delayed
(
kShortDelay
);
await
Future
<
void
>.
delayed
(
kShortDelay
);
},
kShortDelay
);
final
Duration
duration
=
await
completer
.
future
;
expect
(
duration
,
greaterThanOrEqualTo
(
Duration
(
milliseconds:
kShortDelay
.
inMilliseconds
*
2
)));
...
...
This diff is collapsed.
Click to expand it.
packages/flutter_tools/tool/daemon_client.dart
View file @
2d3ff10d
This diff is collapsed.
Click to expand it.
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