apply lint prefer_void_to_null in packages/flutter_tools (#22686)
This commit is contained in:
committed by
GitHub
parent
c26b56cba3
commit
2d3ff10d62
@@ -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);
|
||||
|
||||
@@ -60,7 +60,7 @@ $fontsSection
|
||||
..writeAsStringSync(packages);
|
||||
}
|
||||
|
||||
Future<Null> buildAndVerifyFonts(
|
||||
Future<void> buildAndVerifyFonts(
|
||||
List<String> localFonts,
|
||||
List<String> packageFonts,
|
||||
List<String> packages,
|
||||
|
||||
@@ -66,7 +66,7 @@ $assetsSection
|
||||
..writeAsStringSync(packages);
|
||||
}
|
||||
|
||||
Future<Null> buildAndVerifyAssets(
|
||||
Future<void> buildAndVerifyAssets(
|
||||
List<String> assets,
|
||||
List<String> packages,
|
||||
String expectedAssetManifest,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -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);
|
||||
});
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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'));
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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]);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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');
|
||||
|
||||
@@ -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';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -188,7 +188,7 @@ class DummyFlutterCommand extends FlutterCommand {
|
||||
|
||||
@override
|
||||
Future<FlutterCommandResult> runCommand() async {
|
||||
return commandFunction == null ? null : commandFunction();
|
||||
return commandFunction == null ? null : await commandFunction();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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() { }
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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)));
|
||||
|
||||
Reference in New Issue
Block a user