Unverified Commit 88652122 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Migrate doctor to null safety (#92131)

parent c3242a16
...@@ -19,7 +19,7 @@ import 'src/base/logger.dart'; ...@@ -19,7 +19,7 @@ import 'src/base/logger.dart';
import 'src/base/process.dart'; import 'src/base/process.dart';
import 'src/context_runner.dart'; import 'src/context_runner.dart';
import 'src/doctor.dart'; import 'src/doctor.dart';
import 'src/globals.dart' as globals; import 'src/globals_null_migrated.dart' as globals;
import 'src/reporting/crash_reporting.dart'; import 'src/reporting/crash_reporting.dart';
import 'src/runner/flutter_command.dart'; import 'src/runner/flutter_command.dart';
import 'src/runner/flutter_command_runner.dart'; import 'src/runner/flutter_command_runner.dart';
......
...@@ -256,7 +256,6 @@ class _DeferredComponentAndroidFiles { ...@@ -256,7 +256,6 @@ class _DeferredComponentAndroidFiles {
final Directory templateComponentDir = templatesDir.childDirectory('module${globals.fs.path.separator}android${globals.fs.path.separator}deferred_component'); final Directory templateComponentDir = templatesDir.childDirectory('module${globals.fs.path.separator}android${globals.fs.path.separator}deferred_component');
template = Template(templateComponentDir, templateComponentDir, template = Template(templateComponentDir, templateComponentDir,
fileSystem: globals.fs, fileSystem: globals.fs,
templateManifest: null,
logger: logger, logger: logger,
templateRenderer: globals.templateRenderer, templateRenderer: globals.templateRenderer,
); );
......
...@@ -8,7 +8,7 @@ import '../base/common.dart'; ...@@ -8,7 +8,7 @@ import '../base/common.dart';
import '../base/utils.dart'; import '../base/utils.dart';
import '../convert.dart'; import '../convert.dart';
import '../device.dart'; import '../device.dart';
import '../globals.dart' as globals; import '../globals_null_migrated.dart' as globals;
import '../runner/flutter_command.dart'; import '../runner/flutter_command.dart';
class DevicesCommand extends FlutterCommand { class DevicesCommand extends FlutterCommand {
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
import '../android/android_workflow.dart'; import '../android/android_workflow.dart';
import '../base/common.dart'; import '../base/common.dart';
import '../globals.dart' as globals; import '../globals_null_migrated.dart' as globals;
import '../runner/flutter_command.dart'; import '../runner/flutter_command.dart';
class DoctorCommand extends FlutterCommand { class DoctorCommand extends FlutterCommand {
......
...@@ -8,7 +8,7 @@ import '../base/common.dart'; ...@@ -8,7 +8,7 @@ import '../base/common.dart';
import '../base/utils.dart'; import '../base/utils.dart';
import '../doctor_validator.dart'; import '../doctor_validator.dart';
import '../emulator.dart'; import '../emulator.dart';
import '../globals.dart' as globals; import '../globals_null_migrated.dart' as globals;
import '../runner/flutter_command.dart'; import '../runner/flutter_command.dart';
class EmulatorsCommand extends FlutterCommand { class EmulatorsCommand extends FlutterCommand {
......
...@@ -252,7 +252,6 @@ class IdeConfigCommand extends FlutterCommand { ...@@ -252,7 +252,6 @@ class IdeConfigCommand extends FlutterCommand {
_templateDirectory, _templateDirectory,
null, null,
fileSystem: globals.fs, fileSystem: globals.fs,
templateManifest: <Uri>{},
logger: globals.logger, logger: globals.logger,
templateRenderer: globals.templateRenderer, templateRenderer: globals.templateRenderer,
); );
......
...@@ -444,10 +444,10 @@ abstract class Device { ...@@ -444,10 +444,10 @@ abstract class Device {
final String id; final String id;
/// The [Category] for this device type. /// The [Category] for this device type.
final Category category; final Category? category;
/// The [PlatformType] for this device. /// The [PlatformType] for this device.
final PlatformType platformType; final PlatformType? platformType;
/// Whether this is an ephemeral device. /// Whether this is an ephemeral device.
final bool ephemeral; final bool ephemeral;
......
...@@ -2,9 +2,6 @@ ...@@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:meta/meta.dart';
import 'package:process/process.dart'; import 'package:process/process.dart';
import 'android/android_studio_validator.dart'; import 'android/android_studio_validator.dart';
...@@ -43,7 +40,7 @@ import 'windows/windows_workflow.dart'; ...@@ -43,7 +40,7 @@ import 'windows/windows_workflow.dart';
abstract class DoctorValidatorsProvider { abstract class DoctorValidatorsProvider {
/// The singleton instance, pulled from the [AppContext]. /// The singleton instance, pulled from the [AppContext].
static DoctorValidatorsProvider get instance => context.get<DoctorValidatorsProvider>(); static DoctorValidatorsProvider get _instance => context.get<DoctorValidatorsProvider>()!;
static final DoctorValidatorsProvider defaultInstance = _DefaultDoctorValidatorsProvider(); static final DoctorValidatorsProvider defaultInstance = _DefaultDoctorValidatorsProvider();
...@@ -52,8 +49,8 @@ abstract class DoctorValidatorsProvider { ...@@ -52,8 +49,8 @@ abstract class DoctorValidatorsProvider {
} }
class _DefaultDoctorValidatorsProvider implements DoctorValidatorsProvider { class _DefaultDoctorValidatorsProvider implements DoctorValidatorsProvider {
List<DoctorValidator> _validators; List<DoctorValidator>? _validators;
List<Workflow> _workflows; List<Workflow>? _workflows;
final LinuxWorkflow linuxWorkflow = LinuxWorkflow( final LinuxWorkflow linuxWorkflow = LinuxWorkflow(
platform: globals.platform, platform: globals.platform,
...@@ -73,11 +70,11 @@ class _DefaultDoctorValidatorsProvider implements DoctorValidatorsProvider { ...@@ -73,11 +70,11 @@ class _DefaultDoctorValidatorsProvider implements DoctorValidatorsProvider {
@override @override
List<DoctorValidator> get validators { List<DoctorValidator> get validators {
if (_validators != null) { if (_validators != null) {
return _validators; return _validators!;
} }
final List<DoctorValidator> ideValidators = <DoctorValidator>[ final List<DoctorValidator> ideValidators = <DoctorValidator>[
if (androidWorkflow.appliesToHostPlatform) if (androidWorkflow!.appliesToHostPlatform)
...AndroidStudioValidator.allValidators(globals.config, globals.platform, globals.fs, globals.userMessages), ...AndroidStudioValidator.allValidators(globals.config, globals.platform, globals.fs, globals.userMessages),
...IntelliJValidator.installedValidators( ...IntelliJValidator.installedValidators(
fileSystem: globals.fs, fileSystem: globals.fs,
...@@ -96,14 +93,14 @@ class _DefaultDoctorValidatorsProvider implements DoctorValidatorsProvider { ...@@ -96,14 +93,14 @@ class _DefaultDoctorValidatorsProvider implements DoctorValidatorsProvider {
flutterVersion: () => globals.flutterVersion, flutterVersion: () => globals.flutterVersion,
processManager: globals.processManager, processManager: globals.processManager,
userMessages: userMessages, userMessages: userMessages,
artifacts: globals.artifacts, artifacts: globals.artifacts!,
flutterRoot: () => Cache.flutterRoot, flutterRoot: () => Cache.flutterRoot!,
operatingSystemUtils: globals.os, operatingSystemUtils: globals.os,
), ),
if (androidWorkflow.appliesToHostPlatform) if (androidWorkflow!.appliesToHostPlatform)
GroupedValidator(<DoctorValidator>[androidValidator, androidLicenseValidator]), GroupedValidator(<DoctorValidator>[androidValidator!, androidLicenseValidator!]),
if (globals.iosWorkflow.appliesToHostPlatform || macOSWorkflow.appliesToHostPlatform) if (globals.iosWorkflow!.appliesToHostPlatform || macOSWorkflow.appliesToHostPlatform)
GroupedValidator(<DoctorValidator>[XcodeValidator(xcode: globals.xcode, userMessages: userMessages), globals.cocoapodsValidator]), GroupedValidator(<DoctorValidator>[XcodeValidator(xcode: globals.xcode!, userMessages: userMessages), globals.cocoapodsValidator!]),
if (webWorkflow.appliesToHostPlatform) if (webWorkflow.appliesToHostPlatform)
ChromeValidator( ChromeValidator(
chromiumLauncher: ChromiumLauncher( chromiumLauncher: ChromiumLauncher(
...@@ -121,21 +118,21 @@ class _DefaultDoctorValidatorsProvider implements DoctorValidatorsProvider { ...@@ -121,21 +118,21 @@ class _DefaultDoctorValidatorsProvider implements DoctorValidatorsProvider {
processManager: globals.processManager, processManager: globals.processManager,
userMessages: userMessages, userMessages: userMessages,
), ),
if (windowsWorkflow.appliesToHostPlatform) if (windowsWorkflow!.appliesToHostPlatform)
visualStudioValidator, visualStudioValidator!,
if (ideValidators.isNotEmpty) if (ideValidators.isNotEmpty)
...ideValidators ...ideValidators
else else
NoIdeValidator(), NoIdeValidator(),
if (proxyValidator.shouldShow) if (proxyValidator.shouldShow)
proxyValidator, proxyValidator,
if (globals.deviceManager.canListAnything) if (globals.deviceManager?.canListAnything == true)
DeviceValidator( DeviceValidator(
deviceManager: globals.deviceManager, deviceManager: globals.deviceManager,
userMessages: globals.userMessages, userMessages: globals.userMessages,
), ),
]; ];
return _validators; return _validators!;
} }
@override @override
...@@ -143,48 +140,48 @@ class _DefaultDoctorValidatorsProvider implements DoctorValidatorsProvider { ...@@ -143,48 +140,48 @@ class _DefaultDoctorValidatorsProvider implements DoctorValidatorsProvider {
if (_workflows == null) { if (_workflows == null) {
_workflows = <Workflow>[]; _workflows = <Workflow>[];
if (globals.iosWorkflow.appliesToHostPlatform) { if (globals.iosWorkflow!.appliesToHostPlatform) {
_workflows.add(globals.iosWorkflow); _workflows!.add(globals.iosWorkflow!);
} }
if (androidWorkflow.appliesToHostPlatform) { if (androidWorkflow?.appliesToHostPlatform == true) {
_workflows.add(androidWorkflow); _workflows!.add(androidWorkflow!);
} }
if (fuchsiaWorkflow.appliesToHostPlatform) { if (fuchsiaWorkflow?.appliesToHostPlatform == true) {
_workflows.add(fuchsiaWorkflow); _workflows!.add(fuchsiaWorkflow!);
} }
if (linuxWorkflow.appliesToHostPlatform) { if (linuxWorkflow.appliesToHostPlatform) {
_workflows.add(linuxWorkflow); _workflows!.add(linuxWorkflow);
} }
if (macOSWorkflow.appliesToHostPlatform) { if (macOSWorkflow.appliesToHostPlatform) {
_workflows.add(macOSWorkflow); _workflows!.add(macOSWorkflow);
} }
if (windowsWorkflow.appliesToHostPlatform) { if (windowsWorkflow?.appliesToHostPlatform == true) {
_workflows.add(windowsWorkflow); _workflows!.add(windowsWorkflow!);
} }
if (webWorkflow.appliesToHostPlatform) { if (webWorkflow.appliesToHostPlatform) {
_workflows.add(webWorkflow); _workflows!.add(webWorkflow);
} }
} }
return _workflows; return _workflows!;
} }
} }
class Doctor { class Doctor {
Doctor({ Doctor({
@required Logger logger, required Logger logger,
}) : _logger = logger; }) : _logger = logger;
final Logger _logger; final Logger _logger;
List<DoctorValidator> get validators { List<DoctorValidator> get validators {
return DoctorValidatorsProvider.instance.validators; return DoctorValidatorsProvider._instance.validators;
} }
/// Return a list of [ValidatorTask] objects and starts validation on all /// Return a list of [ValidatorTask] objects and starts validation on all
...@@ -207,7 +204,7 @@ class Doctor { ...@@ -207,7 +204,7 @@ class Doctor {
]; ];
List<Workflow> get workflows { List<Workflow> get workflows {
return DoctorValidatorsProvider.instance.workflows; return DoctorValidatorsProvider._instance.workflows;
} }
/// Print a summary of the state of the tooling, as well as how to get more info. /// Print a summary of the state of the tooling, as well as how to get more info.
...@@ -289,7 +286,7 @@ class Doctor { ...@@ -289,7 +286,7 @@ class Doctor {
bool androidLicenses = false, bool androidLicenses = false,
bool verbose = true, bool verbose = true,
bool showColor = true, bool showColor = true,
AndroidLicenseValidator androidLicenseValidator, AndroidLicenseValidator? androidLicenseValidator,
}) async { }) async {
if (androidLicenses && androidLicenseValidator != null) { if (androidLicenses && androidLicenseValidator != null) {
return androidLicenseValidator.runLicenseManager(); return androidLicenseValidator.runLicenseManager();
...@@ -395,14 +392,14 @@ class Doctor { ...@@ -395,14 +392,14 @@ class Doctor {
/// specific commit information. /// specific commit information.
class FlutterValidator extends DoctorValidator { class FlutterValidator extends DoctorValidator {
FlutterValidator({ FlutterValidator({
@required Platform platform, required Platform platform,
@required FlutterVersion Function() flutterVersion, required FlutterVersion Function() flutterVersion,
@required UserMessages userMessages, required UserMessages userMessages,
@required FileSystem fileSystem, required FileSystem fileSystem,
@required Artifacts artifacts, required Artifacts artifacts,
@required ProcessManager processManager, required ProcessManager processManager,
@required String Function() flutterRoot, required String Function() flutterRoot,
@required OperatingSystemUtils operatingSystemUtils, required OperatingSystemUtils operatingSystemUtils,
}) : _flutterVersion = flutterVersion, }) : _flutterVersion = flutterVersion,
_platform = platform, _platform = platform,
_userMessages = userMessages, _userMessages = userMessages,
...@@ -426,8 +423,8 @@ class FlutterValidator extends DoctorValidator { ...@@ -426,8 +423,8 @@ class FlutterValidator extends DoctorValidator {
Future<ValidationResult> validate() async { Future<ValidationResult> validate() async {
final List<ValidationMessage> messages = <ValidationMessage>[]; final List<ValidationMessage> messages = <ValidationMessage>[];
ValidationType valid = ValidationType.installed; ValidationType valid = ValidationType.installed;
String versionChannel; String? versionChannel;
String frameworkVersion; String? frameworkVersion;
try { try {
final FlutterVersion version = _flutterVersion(); final FlutterVersion version = _flutterVersion();
...@@ -438,8 +435,9 @@ class FlutterValidator extends DoctorValidator { ...@@ -438,8 +435,9 @@ class FlutterValidator extends DoctorValidator {
_flutterRoot(), _flutterRoot(),
))); )));
messages.add(ValidationMessage(_userMessages.flutterUpstreamRepositoryUrl(version.repositoryUrl ?? 'unknown'))); messages.add(ValidationMessage(_userMessages.flutterUpstreamRepositoryUrl(version.repositoryUrl ?? 'unknown')));
if (_platform.environment.containsKey('FLUTTER_GIT_URL')) { final String? gitUrl = _platform.environment['FLUTTER_GIT_URL'];
messages.add(ValidationMessage(_userMessages.flutterGitUrl(_platform.environment['FLUTTER_GIT_URL']))); if (gitUrl != null) {
messages.add(ValidationMessage(_userMessages.flutterGitUrl(gitUrl)));
} }
messages.add(ValidationMessage(_userMessages.flutterRevision( messages.add(ValidationMessage(_userMessages.flutterRevision(
version.frameworkRevisionShort, version.frameworkRevisionShort,
...@@ -448,11 +446,13 @@ class FlutterValidator extends DoctorValidator { ...@@ -448,11 +446,13 @@ class FlutterValidator extends DoctorValidator {
))); )));
messages.add(ValidationMessage(_userMessages.engineRevision(version.engineRevisionShort))); messages.add(ValidationMessage(_userMessages.engineRevision(version.engineRevisionShort)));
messages.add(ValidationMessage(_userMessages.dartRevision(version.dartSdkVersion))); messages.add(ValidationMessage(_userMessages.dartRevision(version.dartSdkVersion)));
if (_platform.environment.containsKey('PUB_HOSTED_URL')) { final String? pubUrl = _platform.environment['PUB_HOSTED_URL'];
messages.add(ValidationMessage(_userMessages.pubMirrorURL(_platform.environment['PUB_HOSTED_URL']))); if (pubUrl != null) {
messages.add(ValidationMessage(_userMessages.pubMirrorURL(pubUrl)));
} }
if (_platform.environment.containsKey('FLUTTER_STORAGE_BASE_URL')) { final String? storageBaseUrl = _platform.environment['FLUTTER_STORAGE_BASE_URL'];
messages.add(ValidationMessage(_userMessages.flutterMirrorURL(_platform.environment['FLUTTER_STORAGE_BASE_URL']))); if (storageBaseUrl != null) {
messages.add(ValidationMessage(_userMessages.flutterMirrorURL(storageBaseUrl)));
} }
} on VersionCheckError catch (e) { } on VersionCheckError catch (e) {
messages.add(ValidationMessage.error(e.message)); messages.add(ValidationMessage.error(e.message));
...@@ -498,9 +498,9 @@ class FlutterValidator extends DoctorValidator { ...@@ -498,9 +498,9 @@ class FlutterValidator extends DoctorValidator {
class DeviceValidator extends DoctorValidator { class DeviceValidator extends DoctorValidator {
// TODO(jmagman): Make required once g3 rolls and is updated. // TODO(jmagman): Make required once g3 rolls and is updated.
DeviceValidator({ DeviceValidator({
DeviceManager deviceManager, DeviceManager? deviceManager,
UserMessages userMessages, UserMessages? userMessages,
}) : _deviceManager = deviceManager ?? globals.deviceManager, }) : _deviceManager = deviceManager ?? globals.deviceManager!,
_userMessages = userMessages ?? globals.userMessages, _userMessages = userMessages ?? globals.userMessages,
super('Connected device'); super('Connected device');
......
...@@ -2,11 +2,6 @@ ...@@ -2,11 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8 // TODO(jmagman): Remove globals_null_migrated.dart, move into globals.dart.
import 'base/context.dart';
import 'doctor.dart';
export 'globals_null_migrated.dart'; export 'globals_null_migrated.dart';
Doctor get doctor => context.get<Doctor>();
...@@ -28,6 +28,7 @@ import 'build_system/build_system.dart'; ...@@ -28,6 +28,7 @@ import 'build_system/build_system.dart';
import 'cache.dart'; import 'cache.dart';
import 'custom_devices/custom_devices_config.dart'; import 'custom_devices/custom_devices_config.dart';
import 'device.dart'; import 'device.dart';
import 'doctor.dart';
import 'fuchsia/fuchsia_sdk.dart'; import 'fuchsia/fuchsia_sdk.dart';
import 'ios/ios_workflow.dart'; import 'ios/ios_workflow.dart';
import 'ios/plist_parser.dart'; import 'ios/plist_parser.dart';
...@@ -54,6 +55,7 @@ CocoaPodsValidator? get cocoapodsValidator => context.get<CocoaPodsValidator>(); ...@@ -54,6 +55,7 @@ CocoaPodsValidator? get cocoapodsValidator => context.get<CocoaPodsValidator>();
Config get config => context.get<Config>()!; Config get config => context.get<Config>()!;
CrashReporter? get crashReporter => context.get<CrashReporter>(); CrashReporter? get crashReporter => context.get<CrashReporter>();
DeviceManager? get deviceManager => context.get<DeviceManager>(); DeviceManager? get deviceManager => context.get<DeviceManager>();
Doctor? get doctor => context.get<Doctor>();
HttpClientFactory? get httpClientFactory => context.get<HttpClientFactory>(); HttpClientFactory? get httpClientFactory => context.get<HttpClientFactory>();
IOSSimulatorUtils? get iosSimulatorUtils => context.get<IOSSimulatorUtils>(); IOSSimulatorUtils? get iosSimulatorUtils => context.get<IOSSimulatorUtils>();
Logger get logger => context.get<Logger>()!; Logger get logger => context.get<Logger>()!;
......
...@@ -26,7 +26,7 @@ import '../dart/package_map.dart'; ...@@ -26,7 +26,7 @@ import '../dart/package_map.dart';
import '../dart/pub.dart'; import '../dart/pub.dart';
import '../device.dart'; import '../device.dart';
import '../features.dart'; import '../features.dart';
import '../globals.dart' as globals; import '../globals_null_migrated.dart' as globals;
import '../project.dart'; import '../project.dart';
import '../reporting/reporting.dart'; import '../reporting/reporting.dart';
import 'flutter_command_runner.dart'; import 'flutter_command_runner.dart';
......
...@@ -42,7 +42,7 @@ class Template { ...@@ -42,7 +42,7 @@ class Template {
required FileSystem fileSystem, required FileSystem fileSystem,
required Logger logger, required Logger logger,
required TemplateRenderer templateRenderer, required TemplateRenderer templateRenderer,
required Set<Uri>? templateManifest, Set<Uri>? templateManifest,
}) { }) {
return Template._( return Template._(
<Directory>[templateSource], <Directory>[templateSource],
......
...@@ -2,11 +2,8 @@ ...@@ -2,11 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:async'; import 'dart:async';
import 'package:meta/meta.dart';
import 'package:process/process.dart'; import 'package:process/process.dart';
import '../application_package.dart'; import '../application_package.dart';
...@@ -51,12 +48,12 @@ class FlutterTesterApp extends ApplicationPackage { ...@@ -51,12 +48,12 @@ class FlutterTesterApp extends ApplicationPackage {
/// to the flutter command. /// to the flutter command.
class FlutterTesterDevice extends Device { class FlutterTesterDevice extends Device {
FlutterTesterDevice(String deviceId, { FlutterTesterDevice(String deviceId, {
@required ProcessManager processManager, required ProcessManager processManager,
@required FlutterVersion flutterVersion, required FlutterVersion flutterVersion,
@required Logger logger, required Logger logger,
@required FileSystem fileSystem, required FileSystem fileSystem,
@required Artifacts artifacts, required Artifacts artifacts,
@required OperatingSystemUtils operatingSystemUtils, required OperatingSystemUtils operatingSystemUtils,
}) : _processManager = processManager, }) : _processManager = processManager,
_flutterVersion = flutterVersion, _flutterVersion = flutterVersion,
_logger = logger, _logger = logger,
...@@ -77,14 +74,14 @@ class FlutterTesterDevice extends Device { ...@@ -77,14 +74,14 @@ class FlutterTesterDevice extends Device {
final Artifacts _artifacts; final Artifacts _artifacts;
final OperatingSystemUtils _operatingSystemUtils; final OperatingSystemUtils _operatingSystemUtils;
Process _process; Process? _process;
final DevicePortForwarder _portForwarder = const NoOpDevicePortForwarder(); final DevicePortForwarder _portForwarder = const NoOpDevicePortForwarder();
@override @override
Future<bool> get isLocalEmulator async => false; Future<bool> get isLocalEmulator async => false;
@override @override
Future<String> get emulatorId async => null; Future<String?> get emulatorId async => null;
@override @override
String get name => 'Flutter test device'; String get name => 'Flutter test device';
...@@ -111,7 +108,7 @@ class FlutterTesterDevice extends Device { ...@@ -111,7 +108,7 @@ class FlutterTesterDevice extends Device {
@override @override
DeviceLogReader getLogReader({ DeviceLogReader getLogReader({
ApplicationPackage app, ApplicationPackage? app,
bool includePastLogs = false, bool includePastLogs = false,
}) { }) {
return _logReader; return _logReader;
...@@ -120,13 +117,13 @@ class FlutterTesterDevice extends Device { ...@@ -120,13 +117,13 @@ class FlutterTesterDevice extends Device {
@override @override
Future<bool> installApp( Future<bool> installApp(
ApplicationPackage app, { ApplicationPackage app, {
String userIdentifier, String? userIdentifier,
}) async => true; }) async => true;
@override @override
Future<bool> isAppInstalled( Future<bool> isAppInstalled(
ApplicationPackage app, { ApplicationPackage app, {
String userIdentifier, String? userIdentifier,
}) async => false; }) async => false;
@override @override
...@@ -138,13 +135,13 @@ class FlutterTesterDevice extends Device { ...@@ -138,13 +135,13 @@ class FlutterTesterDevice extends Device {
@override @override
Future<LaunchResult> startApp( Future<LaunchResult> startApp(
ApplicationPackage package, { ApplicationPackage package, {
@required String mainPath, String? mainPath,
String route, String? route,
DebuggingOptions debuggingOptions, required DebuggingOptions debuggingOptions,
Map<String, dynamic> platformArgs, Map<String, Object?> platformArgs = const <String, Object>{},
bool prebuiltApplication = false, bool prebuiltApplication = false,
bool ipv6 = false, bool ipv6 = false,
String userIdentifier, String? userIdentifier,
}) async { }) async {
final BuildInfo buildInfo = debuggingOptions.buildInfo; final BuildInfo buildInfo = debuggingOptions.buildInfo;
if (!buildInfo.isDebug) { if (!buildInfo.isDebug) {
...@@ -184,7 +181,7 @@ class FlutterTesterDevice extends Device { ...@@ -184,7 +181,7 @@ class FlutterTesterDevice extends Device {
applicationKernelFilePath applicationKernelFilePath
]; ];
ProtocolDiscovery observatoryDiscovery; ProtocolDiscovery? observatoryDiscovery;
try { try {
_logger.printTrace(command.join(' ')); _logger.printTrace(command.join(' '));
_process = await _processManager.start(command, _process = await _processManager.start(command,
...@@ -203,9 +200,9 @@ class FlutterTesterDevice extends Device { ...@@ -203,9 +200,9 @@ class FlutterTesterDevice extends Device {
ipv6: ipv6, ipv6: ipv6,
logger: _logger, logger: _logger,
); );
_logReader.initializeProcess(_process); _logReader.initializeProcess(_process!);
final Uri observatoryUri = await observatoryDiscovery.uri; final Uri? observatoryUri = await observatoryDiscovery.uri;
if (observatoryUri != null) { if (observatoryUri != null) {
return LaunchResult.succeeded(observatoryUri: observatoryUri); return LaunchResult.succeeded(observatoryUri: observatoryUri);
} }
...@@ -224,7 +221,7 @@ class FlutterTesterDevice extends Device { ...@@ -224,7 +221,7 @@ class FlutterTesterDevice extends Device {
@override @override
Future<bool> stopApp( Future<bool> stopApp(
ApplicationPackage app, { ApplicationPackage app, {
String userIdentifier, String? userIdentifier,
}) async { }) async {
_process?.kill(); _process?.kill();
_process = null; _process = null;
...@@ -234,7 +231,7 @@ class FlutterTesterDevice extends Device { ...@@ -234,7 +231,7 @@ class FlutterTesterDevice extends Device {
@override @override
Future<bool> uninstallApp( Future<bool> uninstallApp(
ApplicationPackage app, { ApplicationPackage app, {
String userIdentifier, String? userIdentifier,
}) async => true; }) async => true;
@override @override
...@@ -243,7 +240,7 @@ class FlutterTesterDevice extends Device { ...@@ -243,7 +240,7 @@ class FlutterTesterDevice extends Device {
@override @override
DevFSWriter createDevFSWriter( DevFSWriter createDevFSWriter(
covariant ApplicationPackage app, covariant ApplicationPackage app,
String userIdentifier, String? userIdentifier,
) { ) {
return LocalDevFSWriter( return LocalDevFSWriter(
fileSystem: _fileSystem, fileSystem: _fileSystem,
...@@ -252,19 +249,19 @@ class FlutterTesterDevice extends Device { ...@@ -252,19 +249,19 @@ class FlutterTesterDevice extends Device {
@override @override
Future<void> dispose() async { Future<void> dispose() async {
_logReader?.dispose(); _logReader.dispose();
await _portForwarder?.dispose(); await _portForwarder.dispose();
} }
} }
class FlutterTesterDevices extends PollingDeviceDiscovery { class FlutterTesterDevices extends PollingDeviceDiscovery {
FlutterTesterDevices({ FlutterTesterDevices({
@required FileSystem fileSystem, required FileSystem fileSystem,
@required Artifacts artifacts, required Artifacts artifacts,
@required ProcessManager processManager, required ProcessManager processManager,
@required Logger logger, required Logger logger,
@required FlutterVersion flutterVersion, required FlutterVersion flutterVersion,
@required OperatingSystemUtils operatingSystemUtils, required OperatingSystemUtils operatingSystemUtils,
}) : _testerDevice = FlutterTesterDevice( }) : _testerDevice = FlutterTesterDevice(
kTesterDeviceId, kTesterDeviceId,
fileSystem: fileSystem, fileSystem: fileSystem,
...@@ -289,7 +286,7 @@ class FlutterTesterDevices extends PollingDeviceDiscovery { ...@@ -289,7 +286,7 @@ class FlutterTesterDevices extends PollingDeviceDiscovery {
bool get supportsPlatform => true; bool get supportsPlatform => true;
@override @override
Future<List<Device>> pollingGetDevices({ Duration timeout }) async { Future<List<Device>> pollingGetDevices({ Duration? timeout }) async {
return showFlutterTesterDevice ? <Device>[_testerDevice] : <Device>[]; return showFlutterTesterDevice ? <Device>[_testerDevice] : <Device>[];
} }
......
...@@ -33,7 +33,6 @@ void main() { ...@@ -33,7 +33,6 @@ void main() {
fileSystem: fileSystem, fileSystem: fileSystem,
logger: logger, logger: logger,
templateRenderer: const MustacheTemplateRenderer(), templateRenderer: const MustacheTemplateRenderer(),
templateManifest: null
); );
final Map<String, Object> context = <String, Object>{ final Map<String, Object> context = <String, Object>{
......
...@@ -21,7 +21,6 @@ void main() { ...@@ -21,7 +21,6 @@ void main() {
fileSystem: fileSystem, fileSystem: fileSystem,
logger: BufferLogger.test(), logger: BufferLogger.test(),
templateRenderer: FakeTemplateRenderer(), templateRenderer: FakeTemplateRenderer(),
templateManifest: null,
), throwsToolExit()); ), throwsToolExit());
}); });
...@@ -34,7 +33,6 @@ void main() { ...@@ -34,7 +33,6 @@ void main() {
fileSystem: fileSystem, fileSystem: fileSystem,
logger: BufferLogger.test(), logger: BufferLogger.test(),
templateRenderer: FakeTemplateRenderer(), templateRenderer: FakeTemplateRenderer(),
templateManifest: null,
); );
final Directory directory = fileSystem.directory('foo'); final Directory directory = fileSystem.directory('foo');
handler.addError(directory, FileSystemOp.create, const FileSystemException()); handler.addError(directory, FileSystemOp.create, const FileSystemException());
...@@ -58,7 +56,6 @@ void main() { ...@@ -58,7 +56,6 @@ void main() {
templateDir, templateDir,
imageSourceDir, imageSourceDir,
fileSystem: fileSystem, fileSystem: fileSystem,
templateManifest: null,
logger: BufferLogger.test(), logger: BufferLogger.test(),
templateRenderer: FakeTemplateRenderer(), templateRenderer: FakeTemplateRenderer(),
); );
......
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