Unverified Commit 09987dc0 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Migrate create command to null safety (#104484)

parent b5adbee1
......@@ -155,7 +155,7 @@ class Template {
/// May throw a [ToolExit] if the directory is not writable.
int render(
Directory destination,
Map<String, Object> context, {
Map<String, Object?> context, {
bool overwriteExisting = true,
bool printStatusWhenWriting = true,
}) {
......
......@@ -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);
}
);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment