Migrate create command to null safety (#104484)
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// @dart = 2.8
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:args/args.dart';
|
||||
@@ -20,7 +18,7 @@ import 'package:flutter_tools/src/runner/flutter_command_runner.dart';
|
||||
|
||||
export 'package:test_api/test_api.dart' hide test, isInstanceOf; // ignore: deprecated_member_use
|
||||
|
||||
CommandRunner<void> createTestCommandRunner([ FlutterCommand command ]) {
|
||||
CommandRunner<void> createTestCommandRunner([ FlutterCommand? command ]) {
|
||||
final FlutterCommandRunner runner = TestFlutterCommandRunner();
|
||||
if (command != null) {
|
||||
runner.addCommand(command);
|
||||
@@ -31,7 +29,7 @@ CommandRunner<void> createTestCommandRunner([ FlutterCommand command ]) {
|
||||
/// Creates a flutter project in the [temp] directory using the
|
||||
/// [arguments] list if specified, or `--no-pub` if not.
|
||||
/// Returns the path to the flutter project.
|
||||
Future<String> createProject(Directory temp, { List<String> arguments }) async {
|
||||
Future<String> createProject(Directory temp, { List<String>? arguments }) async {
|
||||
arguments ??= <String>['--no-pub'];
|
||||
final String projectPath = globals.fs.path.join(temp.path, 'flutter_project');
|
||||
final CreateCommand command = CreateCommand();
|
||||
@@ -61,7 +59,7 @@ class TestFlutterCommandRunner extends FlutterCommandRunner {
|
||||
userMessages: UserMessages(),
|
||||
);
|
||||
// For compatibility with tests that set this to a relative path.
|
||||
Cache.flutterRoot = globals.fs.path.normalize(globals.fs.path.absolute(Cache.flutterRoot));
|
||||
Cache.flutterRoot = globals.fs.path.normalize(globals.fs.path.absolute(Cache.flutterRoot!));
|
||||
return super.runCommand(topLevelResults);
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user