more UI-as-code (#35516)
This commit is contained in:
committed by
GitHub
parent
d03aecab58
commit
df4bf453ab
@@ -73,11 +73,10 @@ String getAvdPath() {
|
||||
|
||||
final List<String> searchPaths = <String>[
|
||||
platform.environment['ANDROID_AVD_HOME'],
|
||||
if (platform.environment['HOME'] != null)
|
||||
fs.path.join(platform.environment['HOME'], '.android', 'avd'),
|
||||
];
|
||||
|
||||
if (platform.environment['HOME'] != null) {
|
||||
searchPaths.add(fs.path.join(platform.environment['HOME'], '.android', 'avd'));
|
||||
}
|
||||
|
||||
if (platform.isWindows) {
|
||||
final String homeDrive = platform.environment['HOMEDRIVE'];
|
||||
|
||||
@@ -236,13 +236,13 @@ Future<GradleProject> _readGradleProject({bool isLibrary = false}) async {
|
||||
// flavors and build types defined in the project. If gradle fails, then check if the failure is due to t
|
||||
try {
|
||||
final RunResult propertiesRunResult = await processUtils.run(
|
||||
<String>[gradlew, isLibrary ? 'properties' : 'app:properties'],
|
||||
<String>[gradlew, if (isLibrary) 'properties' else 'app:properties'],
|
||||
throwOnError: true,
|
||||
workingDirectory: hostAppGradleRoot.path,
|
||||
environment: _gradleEnv,
|
||||
);
|
||||
final RunResult tasksRunResult = await processUtils.run(
|
||||
<String>[gradlew, isLibrary ? 'tasks': 'app:tasks', '--all', '--console=auto'],
|
||||
<String>[gradlew, if (isLibrary) 'tasks' else 'app:tasks', '--all', '--console=auto'],
|
||||
throwOnError: true,
|
||||
workingDirectory: hostAppGradleRoot.path,
|
||||
environment: _gradleEnv,
|
||||
|
||||
@@ -418,11 +418,10 @@ DevFSContent _createAssetManifest(Map<_Asset, List<_Asset>> assetVariants) {
|
||||
..sort(_byBasename);
|
||||
|
||||
for (_Asset main in sortedKeys) {
|
||||
final List<String> variants = <String>[];
|
||||
for (_Asset variant in assetVariants[main]) {
|
||||
variants.add(variant.entryUri.path);
|
||||
}
|
||||
jsonObject[main.entryUri.path] = variants;
|
||||
jsonObject[main.entryUri.path] = <String>[
|
||||
for (_Asset variant in assetVariants[main])
|
||||
variant.entryUri.path,
|
||||
];
|
||||
}
|
||||
return DevFSStringContent(json.encode(jsonObject));
|
||||
}
|
||||
|
||||
@@ -142,11 +142,11 @@ class _PosixUtils extends OperatingSystemUtils {
|
||||
|
||||
@override
|
||||
List<File> _which(String execName, { bool all = false }) {
|
||||
final List<String> command = <String>['which'];
|
||||
if (all) {
|
||||
command.add('-a');
|
||||
}
|
||||
command.add(execName);
|
||||
final List<String> command = <String>[
|
||||
'which',
|
||||
if (all) '-a',
|
||||
execName,
|
||||
];
|
||||
final ProcessResult result = processManager.runSync(command);
|
||||
if (result.exitCode != 0) {
|
||||
return const <File>[];
|
||||
|
||||
@@ -191,7 +191,7 @@ class CreateCommand extends FlutterCommand {
|
||||
}
|
||||
|
||||
bool exists(List<String> path) {
|
||||
return fs.directory(fs.path.joinAll(<String>[projectDir.absolute.path] + path)).existsSync();
|
||||
return fs.directory(fs.path.joinAll(<String>[projectDir.absolute.path, ...path])).existsSync();
|
||||
}
|
||||
|
||||
// If it exists, the project type in the metadata is definitive.
|
||||
|
||||
@@ -705,15 +705,11 @@ class DeviceDomain extends Domain {
|
||||
/// Return a list of the current devices, with each device represented as a map
|
||||
/// of properties (id, name, platform, ...).
|
||||
Future<List<Map<String, dynamic>>> getDevices([ Map<String, dynamic> args ]) async {
|
||||
final List<Map<String, dynamic>> devicesInfo = <Map<String, dynamic>>[];
|
||||
|
||||
for (PollingDeviceDiscovery discoverer in _discoverers) {
|
||||
for (Device device in await discoverer.devices) {
|
||||
devicesInfo.add(await _deviceToMap(device));
|
||||
}
|
||||
}
|
||||
|
||||
return devicesInfo;
|
||||
return <Map<String, dynamic>>[
|
||||
for (PollingDeviceDiscovery discoverer in _discoverers)
|
||||
for (Device device in await discoverer.devices)
|
||||
await _deviceToMap(device),
|
||||
];
|
||||
}
|
||||
|
||||
/// Enable device events.
|
||||
|
||||
@@ -225,14 +225,12 @@ class RunCommand extends RunCommandBase {
|
||||
final String modeName = getBuildInfo().modeName;
|
||||
final AndroidProject androidProject = FlutterProject.current().android;
|
||||
final IosProject iosProject = FlutterProject.current().ios;
|
||||
final List<String> hostLanguage = <String>[];
|
||||
|
||||
if (androidProject != null && androidProject.existsSync()) {
|
||||
hostLanguage.add(androidProject.isKotlin ? 'kotlin' : 'java');
|
||||
}
|
||||
if (iosProject != null && iosProject.exists) {
|
||||
hostLanguage.add(await iosProject.isSwift ? 'swift' : 'objc');
|
||||
}
|
||||
final List<String> hostLanguage = <String>[
|
||||
if (androidProject != null && androidProject.existsSync())
|
||||
if (androidProject.isKotlin) 'kotlin' else 'java',
|
||||
if (iosProject != null && iosProject.exists)
|
||||
if (await iosProject.isSwift) 'swift' else 'objc',
|
||||
];
|
||||
|
||||
return <CustomDimensions, String>{
|
||||
CustomDimensions.commandRunIsEmulator: '$isEmulator',
|
||||
@@ -400,22 +398,21 @@ class RunCommand extends RunCommandBase {
|
||||
argResults[FlutterOptions.kEnableExperiment].isNotEmpty) {
|
||||
expFlags = argResults[FlutterOptions.kEnableExperiment];
|
||||
}
|
||||
final List<FlutterDevice> flutterDevices = <FlutterDevice>[];
|
||||
final FlutterProject flutterProject = FlutterProject.current();
|
||||
for (Device device in devices) {
|
||||
final FlutterDevice flutterDevice = await FlutterDevice.create(
|
||||
device,
|
||||
flutterProject: flutterProject,
|
||||
trackWidgetCreation: argResults['track-widget-creation'],
|
||||
fileSystemRoots: argResults['filesystem-root'],
|
||||
fileSystemScheme: argResults['filesystem-scheme'],
|
||||
viewFilter: argResults['isolate-filter'],
|
||||
experimentalFlags: expFlags,
|
||||
target: argResults['target'],
|
||||
buildMode: getBuildMode(),
|
||||
);
|
||||
flutterDevices.add(flutterDevice);
|
||||
}
|
||||
final List<FlutterDevice> flutterDevices = <FlutterDevice>[
|
||||
for (Device device in devices)
|
||||
await FlutterDevice.create(
|
||||
device,
|
||||
flutterProject: flutterProject,
|
||||
trackWidgetCreation: argResults['track-widget-creation'],
|
||||
fileSystemRoots: argResults['filesystem-root'],
|
||||
fileSystemScheme: argResults['filesystem-scheme'],
|
||||
viewFilter: argResults['isolate-filter'],
|
||||
experimentalFlags: expFlags,
|
||||
target: argResults['target'],
|
||||
buildMode: getBuildMode(),
|
||||
),
|
||||
];
|
||||
// Only support "web mode" with a single web device due to resident runner
|
||||
// refactoring required otherwise.
|
||||
final bool webMode = featureFlags.isWebEnabled &&
|
||||
@@ -490,12 +487,16 @@ class RunCommand extends RunCommandBase {
|
||||
return FlutterCommandResult(
|
||||
ExitStatus.success,
|
||||
timingLabelParts: <String>[
|
||||
hotMode ? 'hot' : 'cold',
|
||||
if (hotMode) 'hot' else 'cold',
|
||||
getModeName(getBuildMode()),
|
||||
devices.length == 1
|
||||
? getNameForTargetPlatform(await devices[0].targetPlatform)
|
||||
: 'multiple',
|
||||
devices.length == 1 && await devices[0].isLocalEmulator ? 'emulator' : null,
|
||||
if (devices.length == 1)
|
||||
getNameForTargetPlatform(await devices[0].targetPlatform)
|
||||
else
|
||||
'multiple',
|
||||
if (devices.length == 1 && await devices[0].isLocalEmulator)
|
||||
'emulator'
|
||||
else
|
||||
null,
|
||||
],
|
||||
endTimeOverride: appStartedTime,
|
||||
);
|
||||
|
||||
@@ -270,6 +270,10 @@ class KernelCompiler {
|
||||
if (!processManager.canRun(engineDartPath)) {
|
||||
throwToolExit('Unable to find Dart binary at $engineDartPath');
|
||||
}
|
||||
Uri mainUri;
|
||||
if (packagesPath != null) {
|
||||
mainUri = PackageUriMapper.findUri(mainPath, packagesPath, fileSystemScheme, fileSystemRoots);
|
||||
}
|
||||
final List<String> command = <String>[
|
||||
engineDartPath,
|
||||
frontendServer,
|
||||
@@ -277,55 +281,50 @@ class KernelCompiler {
|
||||
sdkRoot,
|
||||
'--strong',
|
||||
'--target=$targetModel',
|
||||
if (trackWidgetCreation) '--track-widget-creation',
|
||||
if (!linkPlatformKernelIn) '--no-link-platform',
|
||||
if (aot) ...<String>[
|
||||
'--aot',
|
||||
'--tfa',
|
||||
],
|
||||
// If we're not targeting product (release) mode and we're still aot, then
|
||||
// target profile mode.
|
||||
if (targetProductVm)
|
||||
'-Ddart.vm.product=true'
|
||||
else if (aot)
|
||||
'-Ddart.vm.profile=true',
|
||||
if (packagesPath != null) ...<String>[
|
||||
'--packages',
|
||||
packagesPath,
|
||||
],
|
||||
if (outputFilePath != null) ...<String>[
|
||||
'--output-dill',
|
||||
outputFilePath,
|
||||
],
|
||||
if (depFilePath != null && (fileSystemRoots == null || fileSystemRoots.isEmpty)) ...<String>[
|
||||
'--depfile',
|
||||
depFilePath,
|
||||
],
|
||||
if (fileSystemRoots != null)
|
||||
for (String root in fileSystemRoots) ...<String>[
|
||||
'--filesystem-root',
|
||||
root,
|
||||
],
|
||||
if (fileSystemScheme != null) ...<String>[
|
||||
'--filesystem-scheme',
|
||||
fileSystemScheme,
|
||||
],
|
||||
if (initializeFromDill != null) ...<String>[
|
||||
'--initialize-from-dill',
|
||||
initializeFromDill,
|
||||
],
|
||||
if (platformDill != null) ...<String>[
|
||||
'--platform',
|
||||
platformDill,
|
||||
],
|
||||
...?extraFrontEndOptions,
|
||||
mainUri?.toString() ?? mainPath,
|
||||
];
|
||||
if (trackWidgetCreation) {
|
||||
command.add('--track-widget-creation');
|
||||
}
|
||||
if (!linkPlatformKernelIn) {
|
||||
command.add('--no-link-platform');
|
||||
}
|
||||
if (aot) {
|
||||
command.add('--aot');
|
||||
command.add('--tfa');
|
||||
}
|
||||
// If we're not targeting product (release) mode and we're still aot, then
|
||||
// target profile mode.
|
||||
if (targetProductVm) {
|
||||
command.add('-Ddart.vm.product=true');
|
||||
} else if (aot) {
|
||||
command.add('-Ddart.vm.profile=true');
|
||||
}
|
||||
Uri mainUri;
|
||||
if (packagesPath != null) {
|
||||
command.addAll(<String>['--packages', packagesPath]);
|
||||
mainUri = PackageUriMapper.findUri(mainPath, packagesPath, fileSystemScheme, fileSystemRoots);
|
||||
}
|
||||
if (outputFilePath != null) {
|
||||
command.addAll(<String>['--output-dill', outputFilePath]);
|
||||
}
|
||||
if (depFilePath != null && (fileSystemRoots == null || fileSystemRoots.isEmpty)) {
|
||||
command.addAll(<String>['--depfile', depFilePath]);
|
||||
}
|
||||
if (fileSystemRoots != null) {
|
||||
for (String root in fileSystemRoots) {
|
||||
command.addAll(<String>['--filesystem-root', root]);
|
||||
}
|
||||
}
|
||||
if (fileSystemScheme != null) {
|
||||
command.addAll(<String>['--filesystem-scheme', fileSystemScheme]);
|
||||
}
|
||||
if (initializeFromDill != null) {
|
||||
command.addAll(<String>['--initialize-from-dill', initializeFromDill]);
|
||||
}
|
||||
if (platformDill != null) {
|
||||
command.addAll(<String>[ '--platform', platformDill]);
|
||||
}
|
||||
|
||||
if (extraFrontEndOptions != null) {
|
||||
command.addAll(extraFrontEndOptions);
|
||||
}
|
||||
|
||||
command.add(mainUri?.toString() ?? mainPath);
|
||||
|
||||
printTrace(command.join(' '));
|
||||
final Process server = await processManager
|
||||
@@ -562,36 +561,35 @@ class ResidentCompiler {
|
||||
'--incremental',
|
||||
'--strong',
|
||||
'--target=$_targetModel',
|
||||
if (outputPath != null) ...<String>[
|
||||
'--output-dill',
|
||||
outputPath,
|
||||
],
|
||||
if (packagesFilePath != null) ...<String>[
|
||||
'--packages',
|
||||
packagesFilePath,
|
||||
] else if (_packagesPath != null) ...<String>[
|
||||
'--packages',
|
||||
_packagesPath,
|
||||
],
|
||||
if (_trackWidgetCreation) '--track-widget-creation',
|
||||
if (_fileSystemRoots != null)
|
||||
for (String root in _fileSystemRoots) ...<String>[
|
||||
'--filesystem-root',
|
||||
root,
|
||||
],
|
||||
if (_fileSystemScheme != null) ...<String>[
|
||||
'--filesystem-scheme',
|
||||
_fileSystemScheme,
|
||||
],
|
||||
if (_initializeFromDill != null) ...<String>[
|
||||
'--initialize-from-dill',
|
||||
_initializeFromDill,
|
||||
],
|
||||
if (_unsafePackageSerialization == true) '--unsafe-package-serialization',
|
||||
if ((_experimentalFlags != null) && _experimentalFlags.isNotEmpty)
|
||||
'--enable-experiment=${_experimentalFlags.join(',')}',
|
||||
];
|
||||
if (outputPath != null) {
|
||||
command.addAll(<String>['--output-dill', outputPath]);
|
||||
}
|
||||
if (packagesFilePath != null) {
|
||||
command.addAll(<String>['--packages', packagesFilePath]);
|
||||
} else if (_packagesPath != null) {
|
||||
command.addAll(<String>['--packages', _packagesPath]);
|
||||
}
|
||||
if (_trackWidgetCreation) {
|
||||
command.add('--track-widget-creation');
|
||||
}
|
||||
if (_fileSystemRoots != null) {
|
||||
for (String root in _fileSystemRoots) {
|
||||
command.addAll(<String>['--filesystem-root', root]);
|
||||
}
|
||||
}
|
||||
if (_fileSystemScheme != null) {
|
||||
command.addAll(<String>['--filesystem-scheme', _fileSystemScheme]);
|
||||
}
|
||||
if (_initializeFromDill != null) {
|
||||
command.addAll(<String>['--initialize-from-dill', _initializeFromDill]);
|
||||
}
|
||||
if (_unsafePackageSerialization == true) {
|
||||
command.add('--unsafe-package-serialization');
|
||||
}
|
||||
if ((_experimentalFlags != null) && _experimentalFlags.isNotEmpty) {
|
||||
final String expFlags = _experimentalFlags.join(',');
|
||||
command.add('--enable-experiment=$expFlags');
|
||||
}
|
||||
printTrace(command.join(' '));
|
||||
_server = await processManager.start(command);
|
||||
_server.stdout
|
||||
|
||||
@@ -147,22 +147,22 @@ class Doctor {
|
||||
|
||||
/// Return a list of [ValidatorTask] objects and starts validation on all
|
||||
/// objects in [validators].
|
||||
List<ValidatorTask> startValidatorTasks() {
|
||||
final List<ValidatorTask> tasks = <ValidatorTask>[];
|
||||
for (DoctorValidator validator in validators) {
|
||||
// We use an asyncGuard() here to be absolutely certain that
|
||||
// DoctorValidators do not result in an uncaught exception. Since the
|
||||
// Future returned by the asyncGuard() is not awaited, we pass an
|
||||
// onError callback to it and translate errors into ValidationResults.
|
||||
final Future<ValidationResult> result =
|
||||
asyncGuard<ValidationResult>(validator.validate,
|
||||
onError: (Object exception, StackTrace stackTrace) {
|
||||
return ValidationResult.crash(exception, stackTrace);
|
||||
});
|
||||
tasks.add(ValidatorTask(validator, result));
|
||||
}
|
||||
return tasks;
|
||||
}
|
||||
List<ValidatorTask> startValidatorTasks() => <ValidatorTask>[
|
||||
for (DoctorValidator validator in validators)
|
||||
ValidatorTask(
|
||||
validator,
|
||||
// We use an asyncGuard() here to be absolutely certain that
|
||||
// DoctorValidators do not result in an uncaught exception. Since the
|
||||
// Future returned by the asyncGuard() is not awaited, we pass an
|
||||
// onError callback to it and translate errors into ValidationResults.
|
||||
asyncGuard<ValidationResult>(
|
||||
validator.validate,
|
||||
onError: (Object exception, StackTrace stackTrace) {
|
||||
return ValidationResult.crash(exception, stackTrace);
|
||||
},
|
||||
),
|
||||
),
|
||||
];
|
||||
|
||||
List<Workflow> get workflows {
|
||||
return DoctorValidatorsProvider.instance.workflows;
|
||||
@@ -398,12 +398,13 @@ class GroupedValidator extends DoctorValidator {
|
||||
|
||||
@override
|
||||
Future<ValidationResult> validate() async {
|
||||
final List<ValidatorTask> tasks = <ValidatorTask>[];
|
||||
for (DoctorValidator validator in subValidators) {
|
||||
final Future<ValidationResult> result =
|
||||
asyncGuard<ValidationResult>(() => validator.validate());
|
||||
tasks.add(ValidatorTask(validator, result));
|
||||
}
|
||||
final List<ValidatorTask> tasks = <ValidatorTask>[
|
||||
for (DoctorValidator validator in subValidators)
|
||||
ValidatorTask(
|
||||
validator,
|
||||
asyncGuard<ValidationResult>(() => validator.validate()),
|
||||
),
|
||||
];
|
||||
|
||||
final List<ValidationResult> results = <ValidationResult>[];
|
||||
for (ValidatorTask subValidator in tasks) {
|
||||
|
||||
@@ -249,15 +249,15 @@ abstract class Emulator {
|
||||
}
|
||||
|
||||
// Extract emulators information
|
||||
final List<List<String>> table = <List<String>>[];
|
||||
for (Emulator emulator in emulators) {
|
||||
table.add(<String>[
|
||||
emulator.id ?? '',
|
||||
emulator.name ?? '',
|
||||
emulator.manufacturer ?? '',
|
||||
emulator.platformType?.toString() ?? '',
|
||||
]);
|
||||
}
|
||||
final List<List<String>> table = <List<String>>[
|
||||
for (Emulator emulator in emulators)
|
||||
<String>[
|
||||
emulator.id ?? '',
|
||||
emulator.name ?? '',
|
||||
emulator.manufacturer ?? '',
|
||||
emulator.platformType?.toString() ?? '',
|
||||
],
|
||||
];
|
||||
|
||||
// Calculate column widths
|
||||
final List<int> indices = List<int>.generate(table[0].length - 1, (int i) => i);
|
||||
|
||||
@@ -151,7 +151,7 @@ class FuchsiaPM {
|
||||
if (fuchsiaArtifacts.pm == null) {
|
||||
throwToolExit('Fuchsia pm tool not found');
|
||||
}
|
||||
final List<String> command = <String>[fuchsiaArtifacts.pm.path] + args;
|
||||
final List<String> command = <String>[fuchsiaArtifacts.pm.path, ...args];
|
||||
final RunResult result = await processUtils.run(command);
|
||||
return result.exitCode == 0;
|
||||
}
|
||||
|
||||
@@ -47,11 +47,11 @@ class IOSDeploy {
|
||||
bundlePath,
|
||||
'--no-wifi',
|
||||
'--justlaunch',
|
||||
if (launchArguments.isNotEmpty) ...<String>[
|
||||
'--args',
|
||||
'${launchArguments.join(" ")}',
|
||||
],
|
||||
];
|
||||
if (launchArguments.isNotEmpty) {
|
||||
launchCommand.add('--args');
|
||||
launchCommand.add('${launchArguments.join(" ")}');
|
||||
}
|
||||
|
||||
// Push /usr/bin to the front of PATH to pick up default system python, package 'six'.
|
||||
//
|
||||
@@ -303,59 +303,29 @@ class IOSDevice extends Device {
|
||||
}
|
||||
|
||||
// Step 3: Attempt to install the application on the device.
|
||||
final List<String> launchArguments = <String>['--enable-dart-profiling'];
|
||||
|
||||
if (debuggingOptions.startPaused) {
|
||||
launchArguments.add('--start-paused');
|
||||
}
|
||||
|
||||
if (debuggingOptions.disableServiceAuthCodes) {
|
||||
launchArguments.add('--disable-service-auth-codes');
|
||||
}
|
||||
|
||||
if (debuggingOptions.dartFlags.isNotEmpty) {
|
||||
final String dartFlags = debuggingOptions.dartFlags;
|
||||
launchArguments.add('--dart-flags="$dartFlags"');
|
||||
}
|
||||
|
||||
if (debuggingOptions.useTestFonts) {
|
||||
launchArguments.add('--use-test-fonts');
|
||||
}
|
||||
|
||||
// "--enable-checked-mode" and "--verify-entry-points" should always be
|
||||
// passed when we launch debug build via "ios-deploy". However, we don't
|
||||
// pass them if a certain environment variable is set to enable the
|
||||
// "system_debug_ios" integration test in the CI, which simulates a
|
||||
// home-screen launch.
|
||||
if (debuggingOptions.debuggingEnabled &&
|
||||
platform.environment['FLUTTER_TOOLS_DEBUG_WITHOUT_CHECKED_MODE'] != 'true') {
|
||||
launchArguments.add('--enable-checked-mode');
|
||||
launchArguments.add('--verify-entry-points');
|
||||
}
|
||||
|
||||
if (debuggingOptions.enableSoftwareRendering) {
|
||||
launchArguments.add('--enable-software-rendering');
|
||||
}
|
||||
|
||||
if (debuggingOptions.skiaDeterministicRendering) {
|
||||
launchArguments.add('--skia-deterministic-rendering');
|
||||
}
|
||||
|
||||
if (debuggingOptions.traceSkia) {
|
||||
launchArguments.add('--trace-skia');
|
||||
}
|
||||
|
||||
if (debuggingOptions.dumpSkpOnShaderCompilation) {
|
||||
launchArguments.add('--dump-skp-on-shader-compilation');
|
||||
}
|
||||
|
||||
if (debuggingOptions.verboseSystemLogs) {
|
||||
launchArguments.add('--verbose-logging');
|
||||
}
|
||||
|
||||
if (platformArgs['trace-startup'] ?? false) {
|
||||
launchArguments.add('--trace-startup');
|
||||
}
|
||||
final List<String> launchArguments = <String>[
|
||||
'--enable-dart-profiling',
|
||||
if (debuggingOptions.startPaused) '--start-paused',
|
||||
if (debuggingOptions.disableServiceAuthCodes) '--disable-service-auth-codes',
|
||||
if (debuggingOptions.dartFlags.isNotEmpty) '--dart-flags="${debuggingOptions.dartFlags}"',
|
||||
if (debuggingOptions.useTestFonts) '--use-test-fonts',
|
||||
// "--enable-checked-mode" and "--verify-entry-points" should always be
|
||||
// passed when we launch debug build via "ios-deploy". However, we don't
|
||||
// pass them if a certain environment variable is set to enable the
|
||||
// "system_debug_ios" integration test in the CI, which simulates a
|
||||
// home-screen launch.
|
||||
if (debuggingOptions.debuggingEnabled &&
|
||||
platform.environment['FLUTTER_TOOLS_DEBUG_WITHOUT_CHECKED_MODE'] != 'true') ...<String>[
|
||||
'--enable-checked-mode',
|
||||
'--verify-entry-points',
|
||||
],
|
||||
if (debuggingOptions.enableSoftwareRendering) '--enable-software-rendering',
|
||||
if (debuggingOptions.skiaDeterministicRendering) '--skia-deterministic-rendering',
|
||||
if (debuggingOptions.traceSkia) '--trace-skia',
|
||||
if (debuggingOptions.dumpSkpOnShaderCompilation) '--dump-skp-on-shader-compilation',
|
||||
if (debuggingOptions.verboseSystemLogs) '--verbose-logging',
|
||||
if (platformArgs['trace-startup'] ?? false) '--trace-startup',
|
||||
];
|
||||
|
||||
final Status installStatus = logger.startProgress(
|
||||
'Installing and launching...',
|
||||
|
||||
@@ -42,10 +42,12 @@ class IOSEmulator extends Emulator {
|
||||
@override
|
||||
Future<void> launch() async {
|
||||
Future<bool> launchSimulator(List<String> additionalArgs) async {
|
||||
final List<String> args = <String>['open']
|
||||
.followedBy(additionalArgs)
|
||||
.followedBy(<String>['-a', xcode.getSimulatorPath()])
|
||||
.toList();
|
||||
final List<String> args = <String>[
|
||||
'open',
|
||||
...additionalArgs,
|
||||
'-a',
|
||||
xcode.getSimulatorPath(),
|
||||
];
|
||||
|
||||
final RunResult launchResult = await processUtils.run(args);
|
||||
if (launchResult.exitCode != 0) {
|
||||
|
||||
@@ -361,30 +361,20 @@ class IOSSimulator extends Device {
|
||||
}
|
||||
|
||||
// Prepare launch arguments.
|
||||
final List<String> args = <String>['--enable-dart-profiling'];
|
||||
|
||||
if (debuggingOptions.debuggingEnabled) {
|
||||
if (debuggingOptions.buildInfo.isDebug) {
|
||||
args.addAll(<String>[
|
||||
final List<String> args = <String>[
|
||||
'--enable-dart-profiling',
|
||||
if (debuggingOptions.debuggingEnabled) ...<String>[
|
||||
if (debuggingOptions.buildInfo.isDebug) ...<String>[
|
||||
'--enable-checked-mode',
|
||||
'--verify-entry-points',
|
||||
]);
|
||||
}
|
||||
if (debuggingOptions.startPaused) {
|
||||
args.add('--start-paused');
|
||||
}
|
||||
if (debuggingOptions.disableServiceAuthCodes) {
|
||||
args.add('--disable-service-auth-codes');
|
||||
}
|
||||
if (debuggingOptions.skiaDeterministicRendering) {
|
||||
args.add('--skia-deterministic-rendering');
|
||||
}
|
||||
if (debuggingOptions.useTestFonts) {
|
||||
args.add('--use-test-fonts');
|
||||
}
|
||||
final int observatoryPort = debuggingOptions.observatoryPort ?? 0;
|
||||
args.add('--observatory-port=$observatoryPort');
|
||||
}
|
||||
],
|
||||
if (debuggingOptions.startPaused) '--start-paused',
|
||||
if (debuggingOptions.disableServiceAuthCodes) '--disable-service-auth-codes',
|
||||
if (debuggingOptions.skiaDeterministicRendering) '--skia-deterministic-rendering',
|
||||
if (debuggingOptions.useTestFonts) '--use-test-fonts',
|
||||
'--observatory-port=${debuggingOptions.observatoryPort ?? 0}',
|
||||
]
|
||||
];
|
||||
|
||||
ProtocolDiscovery observatoryDiscovery;
|
||||
if (debuggingOptions.debuggingEnabled) {
|
||||
|
||||
@@ -137,10 +137,9 @@ class FlutterDevice {
|
||||
if (vmServices == null || vmServices.isEmpty) {
|
||||
return Future<void>.value(null);
|
||||
}
|
||||
final List<Future<void>> futures = <Future<void>>[];
|
||||
for (VMService service in vmServices) {
|
||||
futures.add(service.vm.refreshViews(waitForViews: true));
|
||||
}
|
||||
final List<Future<void>> futures = <Future<void>>[
|
||||
for (VMService service in vmServices) service.vm.refreshViews(waitForViews: true),
|
||||
];
|
||||
await Future.wait(futures);
|
||||
}
|
||||
|
||||
@@ -221,16 +220,14 @@ class FlutterDevice {
|
||||
}) {
|
||||
final Uri deviceEntryUri = devFS.baseUri.resolveUri(fs.path.toUri(entryPath));
|
||||
final Uri devicePackagesUri = devFS.baseUri.resolve('.packages');
|
||||
final List<Future<Map<String, dynamic>>> reports = <Future<Map<String, dynamic>>>[];
|
||||
for (FlutterView view in views) {
|
||||
final Future<Map<String, dynamic>> report = view.uiIsolate.reloadSources(
|
||||
pause: pause,
|
||||
rootLibUri: deviceEntryUri,
|
||||
packagesUri: devicePackagesUri,
|
||||
);
|
||||
reports.add(report);
|
||||
}
|
||||
return reports;
|
||||
return <Future<Map<String, dynamic>>>[
|
||||
for (FlutterView view in views)
|
||||
view.uiIsolate.reloadSources(
|
||||
pause: pause,
|
||||
rootLibUri: deviceEntryUri,
|
||||
packagesUri: devicePackagesUri,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
Future<void> resetAssetDirectory() async {
|
||||
@@ -656,10 +653,9 @@ abstract class ResidentRunner {
|
||||
}
|
||||
|
||||
Future<void> refreshViews() async {
|
||||
final List<Future<void>> futures = <Future<void>>[];
|
||||
for (FlutterDevice device in flutterDevices) {
|
||||
futures.add(device.refreshViews());
|
||||
}
|
||||
final List<Future<void>> futures = <Future<void>>[
|
||||
for (FlutterDevice device in flutterDevices) device.refreshViews(),
|
||||
];
|
||||
await Future.wait(futures);
|
||||
}
|
||||
|
||||
@@ -893,10 +889,9 @@ abstract class ResidentRunner {
|
||||
}
|
||||
|
||||
Future<void> exitApp() async {
|
||||
final List<Future<void>> futures = <Future<void>>[];
|
||||
for (FlutterDevice device in flutterDevices) {
|
||||
futures.add(device.exitApps());
|
||||
}
|
||||
final List<Future<void>> futures = <Future<void>>[
|
||||
for (FlutterDevice device in flutterDevices) device.exitApps(),
|
||||
];
|
||||
await Future.wait(futures);
|
||||
appFinished();
|
||||
}
|
||||
|
||||
@@ -272,16 +272,14 @@ class HotRunner extends ResidentRunner {
|
||||
|
||||
Future<List<Uri>> _initDevFS() async {
|
||||
final String fsName = fs.path.basename(projectRootPath);
|
||||
final List<Uri> devFSUris = <Uri>[];
|
||||
for (FlutterDevice device in flutterDevices) {
|
||||
final Uri uri = await device.setupDevFS(
|
||||
fsName,
|
||||
fs.directory(projectRootPath),
|
||||
packagesFilePath: packagesFilePath,
|
||||
);
|
||||
devFSUris.add(uri);
|
||||
}
|
||||
return devFSUris;
|
||||
return <Uri>[
|
||||
for (FlutterDevice device in flutterDevices)
|
||||
await device.setupDevFS(
|
||||
fsName,
|
||||
fs.directory(projectRootPath),
|
||||
packagesFilePath: packagesFilePath,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
Future<UpdateFSReport> _updateDevFS({ bool fullRestart = false }) async {
|
||||
@@ -350,10 +348,9 @@ class HotRunner extends ResidentRunner {
|
||||
Uri packagesUri,
|
||||
Uri assetsDirectoryUri,
|
||||
) {
|
||||
final List<Future<void>> futures = <Future<void>>[];
|
||||
for (FlutterView view in device.views) {
|
||||
futures.add(view.runFromSource(entryUri, packagesUri, assetsDirectoryUri));
|
||||
}
|
||||
final List<Future<void>> futures = <Future<void>>[
|
||||
for (FlutterView view in device.views) view.runFromSource(entryUri, packagesUri, assetsDirectoryUri),
|
||||
];
|
||||
final Completer<void> completer = Completer<void>();
|
||||
Future.wait(futures).whenComplete(() { completer.complete(null); });
|
||||
return completer.future;
|
||||
@@ -833,18 +830,18 @@ class HotRunner extends ResidentRunner {
|
||||
assert(reassembleViews.isNotEmpty);
|
||||
printTrace('Reassembling application');
|
||||
bool failedReassemble = false;
|
||||
final List<Future<void>> futures = <Future<void>>[];
|
||||
for (FlutterView view in reassembleViews) {
|
||||
futures.add(() async {
|
||||
try {
|
||||
await view.uiIsolate.flutterReassemble();
|
||||
} catch (error) {
|
||||
failedReassemble = true;
|
||||
printError('Reassembling ${view.uiIsolate.name} failed: $error');
|
||||
return;
|
||||
}
|
||||
}());
|
||||
}
|
||||
final List<Future<void>> futures = <Future<void>>[
|
||||
for (FlutterView view in reassembleViews)
|
||||
() async {
|
||||
try {
|
||||
await view.uiIsolate.flutterReassemble();
|
||||
} catch (error) {
|
||||
failedReassemble = true;
|
||||
printError('Reassembling ${view.uiIsolate.name} failed: $error');
|
||||
return;
|
||||
}
|
||||
}(),
|
||||
];
|
||||
final Future<void> reassembleFuture = Future.wait<void>(futures).then<void>((List<void> values) { });
|
||||
await reassembleFuture.timeout(
|
||||
const Duration(seconds: 2),
|
||||
|
||||
@@ -813,38 +813,26 @@ class FlutterPlatform extends PlatformPlugin {
|
||||
}) {
|
||||
assert(executable != null); // Please provide the path to the shell in the SKY_SHELL environment variable.
|
||||
assert(!startPaused || enableObservatory);
|
||||
final List<String> command = <String>[executable];
|
||||
if (enableObservatory) {
|
||||
// Some systems drive the _FlutterPlatform class in an unusual way, where
|
||||
// only one test file is processed at a time, and the operating
|
||||
// environment hands out specific ports ahead of time in a cooperative
|
||||
// manner, where we're only allowed to open ports that were given to us in
|
||||
// advance like this. For those esoteric systems, we have this feature
|
||||
// whereby you can create _FlutterPlatform with a pair of ports.
|
||||
//
|
||||
// I mention this only so that you won't be tempted, as I was, to apply
|
||||
// the obvious simplification to this code and remove this entire feature.
|
||||
if (observatoryPort != null) {
|
||||
command.add('--observatory-port=$observatoryPort');
|
||||
}
|
||||
if (startPaused) {
|
||||
command.add('--start-paused');
|
||||
}
|
||||
if (disableServiceAuthCodes) {
|
||||
command.add('--disable-service-auth-codes');
|
||||
}
|
||||
} else {
|
||||
command.add('--disable-observatory');
|
||||
}
|
||||
if (host.type == InternetAddressType.IPv6) {
|
||||
command.add('--ipv6');
|
||||
}
|
||||
|
||||
if (icudtlPath != null) {
|
||||
command.add('--icu-data-file-path=$icudtlPath');
|
||||
}
|
||||
|
||||
command.addAll(<String>[
|
||||
final List<String> command = <String>[
|
||||
executable,
|
||||
if (enableObservatory) ...<String>[
|
||||
// Some systems drive the _FlutterPlatform class in an unusual way, where
|
||||
// only one test file is processed at a time, and the operating
|
||||
// environment hands out specific ports ahead of time in a cooperative
|
||||
// manner, where we're only allowed to open ports that were given to us in
|
||||
// advance like this. For those esoteric systems, we have this feature
|
||||
// whereby you can create _FlutterPlatform with a pair of ports.
|
||||
//
|
||||
// I mention this only so that you won't be tempted, as I was, to apply
|
||||
// the obvious simplification to this code and remove this entire feature.
|
||||
if (observatoryPort != null) '--observatory-port=$observatoryPort',
|
||||
if (startPaused) '--start-paused',
|
||||
if (disableServiceAuthCodes) '--disable-service-auth-codes',
|
||||
]
|
||||
else
|
||||
'--disable-observatory',
|
||||
if (host.type == InternetAddressType.IPv6) '--ipv6',
|
||||
if (icudtlPath != null) '--icu-data-file-path=$icudtlPath',
|
||||
'--enable-checked-mode',
|
||||
'--verify-entry-points',
|
||||
'--enable-software-rendering',
|
||||
@@ -854,7 +842,8 @@ class FlutterPlatform extends PlatformPlugin {
|
||||
'--use-test-fonts',
|
||||
'--packages=$packages',
|
||||
testPath,
|
||||
]);
|
||||
];
|
||||
|
||||
printTrace(command.join(' '));
|
||||
// If the FLUTTER_TEST environment variable has been set, then pass it on
|
||||
// for package:flutter_test to handle the value.
|
||||
@@ -869,11 +858,9 @@ class FlutterPlatform extends PlatformPlugin {
|
||||
'FONTCONFIG_FILE': _fontConfigFile.path,
|
||||
'SERVER_PORT': serverPort.toString(),
|
||||
'APP_NAME': flutterProject?.manifest?.appName ?? '',
|
||||
if (buildTestAssets)
|
||||
'UNIT_TEST_ASSETS': fs.path.join(flutterProject?.directory?.path ?? '', 'build', 'unit_test_assets'),
|
||||
};
|
||||
if (buildTestAssets) {
|
||||
environment['UNIT_TEST_ASSETS'] = fs.path.join(
|
||||
flutterProject?.directory?.path ?? '', 'build', 'unit_test_assets');
|
||||
}
|
||||
return processManager.start(command, environment: environment);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,20 +15,18 @@ class WebValidator extends DoctorValidator {
|
||||
Future<ValidationResult> validate() async {
|
||||
final String chrome = findChromeExecutable();
|
||||
final bool canRunChrome = canFindChrome();
|
||||
final List<ValidationMessage> messages = <ValidationMessage>[];
|
||||
if (platform.environment.containsKey(kChromeEnvironment)) {
|
||||
if (!canRunChrome) {
|
||||
messages.add(ValidationMessage.hint('$chrome is not executable.'));
|
||||
} else {
|
||||
messages.add(ValidationMessage('$kChromeEnvironment = $chrome'));
|
||||
}
|
||||
} else {
|
||||
if (!canRunChrome) {
|
||||
messages.add(ValidationMessage.hint('$kChromeEnvironment not set'));
|
||||
} else {
|
||||
messages.add(ValidationMessage('Chrome at $chrome'));
|
||||
}
|
||||
}
|
||||
final List<ValidationMessage> messages = <ValidationMessage>[
|
||||
if (platform.environment.containsKey(kChromeEnvironment))
|
||||
if (!canRunChrome)
|
||||
ValidationMessage.hint('$chrome is not executable.')
|
||||
else
|
||||
ValidationMessage('$kChromeEnvironment = $chrome')
|
||||
else
|
||||
if (!canRunChrome)
|
||||
ValidationMessage.hint('$kChromeEnvironment not set')
|
||||
else
|
||||
ValidationMessage('Chrome at $chrome'),
|
||||
];
|
||||
if (!canRunChrome) {
|
||||
return ValidationResult(
|
||||
ValidationType.missing,
|
||||
|
||||
@@ -1134,17 +1134,14 @@ Future<void> _createProject(
|
||||
return fs.typeSync(fullPath) != FileSystemEntityType.notFound;
|
||||
}
|
||||
|
||||
final List<String> failures = <String>[];
|
||||
for (String path in expectedPaths) {
|
||||
if (!pathExists(path)) {
|
||||
failures.add('Path "$path" does not exist.');
|
||||
}
|
||||
}
|
||||
for (String path in unexpectedPaths) {
|
||||
if (pathExists(path)) {
|
||||
failures.add('Path "$path" exists when it shouldn\'t.');
|
||||
}
|
||||
}
|
||||
final List<String> failures = <String>[
|
||||
for (String path in expectedPaths)
|
||||
if (!pathExists(path))
|
||||
'Path "$path" does not exist.',
|
||||
for (String path in unexpectedPaths)
|
||||
if (pathExists(path))
|
||||
'Path "$path" exists when it shouldn\'t.',
|
||||
];
|
||||
expect(failures, isEmpty, reason: failures.join('\n'));
|
||||
}
|
||||
|
||||
|
||||
@@ -653,9 +653,10 @@ class PassingValidator extends DoctorValidator {
|
||||
|
||||
@override
|
||||
Future<ValidationResult> validate() async {
|
||||
final List<ValidationMessage> messages = <ValidationMessage>[];
|
||||
messages.add(ValidationMessage('A helpful message'));
|
||||
messages.add(ValidationMessage('A second, somewhat longer helpful message'));
|
||||
final List<ValidationMessage> messages = <ValidationMessage>[
|
||||
ValidationMessage('A helpful message'),
|
||||
ValidationMessage('A second, somewhat longer helpful message'),
|
||||
];
|
||||
return ValidationResult(ValidationType.installed, messages, statusInfo: 'with statusInfo');
|
||||
}
|
||||
}
|
||||
@@ -665,10 +666,11 @@ class MissingValidator extends DoctorValidator {
|
||||
|
||||
@override
|
||||
Future<ValidationResult> validate() async {
|
||||
final List<ValidationMessage> messages = <ValidationMessage>[];
|
||||
messages.add(ValidationMessage.error('A useful error message'));
|
||||
messages.add(ValidationMessage('A message that is not an error'));
|
||||
messages.add(ValidationMessage.hint('A hint message'));
|
||||
final List<ValidationMessage> messages = <ValidationMessage>[
|
||||
ValidationMessage.error('A useful error message'),
|
||||
ValidationMessage('A message that is not an error'),
|
||||
ValidationMessage.hint('A hint message'),
|
||||
];
|
||||
return ValidationResult(ValidationType.missing, messages);
|
||||
}
|
||||
}
|
||||
@@ -678,10 +680,11 @@ class NotAvailableValidator extends DoctorValidator {
|
||||
|
||||
@override
|
||||
Future<ValidationResult> validate() async {
|
||||
final List<ValidationMessage> messages = <ValidationMessage>[];
|
||||
messages.add(ValidationMessage.error('A useful error message'));
|
||||
messages.add(ValidationMessage('A message that is not an error'));
|
||||
messages.add(ValidationMessage.hint('A hint message'));
|
||||
final List<ValidationMessage> messages = <ValidationMessage>[
|
||||
ValidationMessage.error('A useful error message'),
|
||||
ValidationMessage('A message that is not an error'),
|
||||
ValidationMessage.hint('A hint message'),
|
||||
];
|
||||
return ValidationResult(ValidationType.notAvailable, messages);
|
||||
}
|
||||
}
|
||||
@@ -691,10 +694,11 @@ class PartialValidatorWithErrors extends DoctorValidator {
|
||||
|
||||
@override
|
||||
Future<ValidationResult> validate() async {
|
||||
final List<ValidationMessage> messages = <ValidationMessage>[];
|
||||
messages.add(ValidationMessage.error('An error message indicating partial installation'));
|
||||
messages.add(ValidationMessage.hint('Maybe a hint will help the user'));
|
||||
messages.add(ValidationMessage('An extra message with some verbose details'));
|
||||
final List<ValidationMessage> messages = <ValidationMessage>[
|
||||
ValidationMessage.error('An error message indicating partial installation'),
|
||||
ValidationMessage.hint('Maybe a hint will help the user'),
|
||||
ValidationMessage('An extra message with some verbose details'),
|
||||
];
|
||||
return ValidationResult(ValidationType.partial, messages);
|
||||
}
|
||||
}
|
||||
@@ -704,9 +708,10 @@ class PartialValidatorWithHintsOnly extends DoctorValidator {
|
||||
|
||||
@override
|
||||
Future<ValidationResult> validate() async {
|
||||
final List<ValidationMessage> messages = <ValidationMessage>[];
|
||||
messages.add(ValidationMessage.hint('There is a hint here'));
|
||||
messages.add(ValidationMessage('But there is no error'));
|
||||
final List<ValidationMessage> messages = <ValidationMessage>[
|
||||
ValidationMessage.hint('There is a hint here'),
|
||||
ValidationMessage('But there is no error'),
|
||||
];
|
||||
return ValidationResult(ValidationType.partial, messages);
|
||||
}
|
||||
}
|
||||
@@ -744,15 +749,13 @@ class FakeDoctor extends Doctor {
|
||||
|
||||
@override
|
||||
List<DoctorValidator> get validators {
|
||||
if (_validators == null) {
|
||||
_validators = <DoctorValidator>[];
|
||||
_validators.add(PassingValidator('Passing Validator'));
|
||||
_validators.add(MissingValidator());
|
||||
_validators.add(NotAvailableValidator());
|
||||
_validators.add(PartialValidatorWithHintsOnly());
|
||||
_validators.add(PartialValidatorWithErrors());
|
||||
}
|
||||
return _validators;
|
||||
return _validators ??= <DoctorValidator>[
|
||||
PassingValidator('Passing Validator'),
|
||||
MissingValidator(),
|
||||
NotAvailableValidator(),
|
||||
PartialValidatorWithHintsOnly(),
|
||||
PartialValidatorWithErrors(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -761,14 +764,12 @@ class FakePassingDoctor extends Doctor {
|
||||
List<DoctorValidator> _validators;
|
||||
@override
|
||||
List<DoctorValidator> get validators {
|
||||
if (_validators == null) {
|
||||
_validators = <DoctorValidator>[];
|
||||
_validators.add(PassingValidator('Passing Validator'));
|
||||
_validators.add(PartialValidatorWithHintsOnly());
|
||||
_validators.add(PartialValidatorWithErrors());
|
||||
_validators.add(PassingValidator('Another Passing Validator'));
|
||||
}
|
||||
return _validators;
|
||||
return _validators ??= <DoctorValidator>[
|
||||
PassingValidator('Passing Validator'),
|
||||
PartialValidatorWithHintsOnly(),
|
||||
PartialValidatorWithErrors(),
|
||||
PassingValidator('Another Passing Validator'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -778,11 +779,9 @@ class FakeSinglePassingDoctor extends Doctor {
|
||||
List<DoctorValidator> _validators;
|
||||
@override
|
||||
List<DoctorValidator> get validators {
|
||||
if (_validators == null) {
|
||||
_validators = <DoctorValidator>[];
|
||||
_validators.add(PartialValidatorWithHintsOnly());
|
||||
}
|
||||
return _validators;
|
||||
return _validators ??= <DoctorValidator>[
|
||||
PartialValidatorWithHintsOnly(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -791,14 +790,12 @@ class FakeQuietDoctor extends Doctor {
|
||||
List<DoctorValidator> _validators;
|
||||
@override
|
||||
List<DoctorValidator> get validators {
|
||||
if (_validators == null) {
|
||||
_validators = <DoctorValidator>[];
|
||||
_validators.add(PassingValidator('Passing Validator'));
|
||||
_validators.add(PassingValidator('Another Passing Validator'));
|
||||
_validators.add(PassingValidator('Validators are fun'));
|
||||
_validators.add(PassingValidator('Four score and seven validators ago'));
|
||||
}
|
||||
return _validators;
|
||||
return _validators ??= <DoctorValidator>[
|
||||
PassingValidator('Passing Validator'),
|
||||
PassingValidator('Another Passing Validator'),
|
||||
PassingValidator('Validators are fun'),
|
||||
PassingValidator('Four score and seven validators ago'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -861,8 +858,9 @@ class PassingGroupedValidator extends DoctorValidator {
|
||||
|
||||
@override
|
||||
Future<ValidationResult> validate() async {
|
||||
final List<ValidationMessage> messages = <ValidationMessage>[];
|
||||
messages.add(ValidationMessage('A helpful message'));
|
||||
final List<ValidationMessage> messages = <ValidationMessage>[
|
||||
ValidationMessage('A helpful message'),
|
||||
];
|
||||
return ValidationResult(ValidationType.installed, messages);
|
||||
}
|
||||
}
|
||||
@@ -872,8 +870,9 @@ class MissingGroupedValidator extends DoctorValidator {
|
||||
|
||||
@override
|
||||
Future<ValidationResult> validate() async {
|
||||
final List<ValidationMessage> messages = <ValidationMessage>[];
|
||||
messages.add(ValidationMessage.error('A useful error message'));
|
||||
final List<ValidationMessage> messages = <ValidationMessage>[
|
||||
ValidationMessage.error('A useful error message'),
|
||||
];
|
||||
return ValidationResult(ValidationType.missing, messages);
|
||||
}
|
||||
}
|
||||
@@ -883,8 +882,9 @@ class PartialGroupedValidator extends DoctorValidator {
|
||||
|
||||
@override
|
||||
Future<ValidationResult> validate() async {
|
||||
final List<ValidationMessage> messages = <ValidationMessage>[];
|
||||
messages.add(ValidationMessage.error('An error message for partial installation'));
|
||||
final List<ValidationMessage> messages = <ValidationMessage>[
|
||||
ValidationMessage.error('An error message for partial installation'),
|
||||
];
|
||||
return ValidationResult(ValidationType.partial, messages);
|
||||
}
|
||||
}
|
||||
@@ -894,8 +894,9 @@ class PassingGroupedValidatorWithStatus extends DoctorValidator {
|
||||
|
||||
@override
|
||||
Future<ValidationResult> validate() async {
|
||||
final List<ValidationMessage> messages = <ValidationMessage>[];
|
||||
messages.add(ValidationMessage('A different message'));
|
||||
final List<ValidationMessage> messages = <ValidationMessage>[
|
||||
ValidationMessage('A different message'),
|
||||
];
|
||||
return ValidationResult(ValidationType.installed, messages, statusInfo: 'A status message');
|
||||
}
|
||||
}
|
||||
@@ -905,18 +906,16 @@ class FakeGroupedDoctor extends Doctor {
|
||||
List<DoctorValidator> _validators;
|
||||
@override
|
||||
List<DoctorValidator> get validators {
|
||||
if (_validators == null) {
|
||||
_validators = <DoctorValidator>[];
|
||||
_validators.add(GroupedValidator(<DoctorValidator>[
|
||||
return _validators ??= <DoctorValidator>[
|
||||
GroupedValidator(<DoctorValidator>[
|
||||
PassingGroupedValidator('Category 1'),
|
||||
PassingGroupedValidator('Category 1'),
|
||||
]));
|
||||
_validators.add(GroupedValidator(<DoctorValidator>[
|
||||
]),
|
||||
GroupedValidator(<DoctorValidator>[
|
||||
PassingGroupedValidator('Category 2'),
|
||||
MissingGroupedValidator('Category 2'),
|
||||
]));
|
||||
}
|
||||
return _validators;
|
||||
]),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -924,12 +923,12 @@ class FakeGroupedDoctorWithStatus extends Doctor {
|
||||
List<DoctorValidator> _validators;
|
||||
@override
|
||||
List<DoctorValidator> get validators {
|
||||
_validators ??= <DoctorValidator>[
|
||||
return _validators ??= <DoctorValidator>[
|
||||
GroupedValidator(<DoctorValidator>[
|
||||
PassingGroupedValidator('First validator title'),
|
||||
PassingGroupedValidatorWithStatus('Second validator title'),
|
||||
])];
|
||||
return _validators;
|
||||
]),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -937,8 +936,9 @@ class FlutterValidatorDoctor extends Doctor {
|
||||
List<DoctorValidator> _validators;
|
||||
@override
|
||||
List<DoctorValidator> get validators {
|
||||
_validators ??= <DoctorValidator>[FlutterValidator()];
|
||||
return _validators;
|
||||
return _validators ??= <DoctorValidator>[
|
||||
FlutterValidator(),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user