Files
flutter/packages/flutter_tools/lib/src/vscode/vscode_validator.dart
Andrew Kolos 13db2e4a76 [tool] In flutter doctor -v, warn when Android Studio version could not be detected. (#126395)
Fixes #122081.

When validating an Android Studio installation, add a warning validation message when we are unable to detect the version. This is because we have logic throughout the tool (JDK/JRE-searching) that is at higher risk of failing when we don't know the version.
2023-06-01 14:51:30 +00:00

44 lines
1.4 KiB
Dart

// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:process/process.dart';
import '../base/file_system.dart';
import '../base/platform.dart';
import '../base/user_messages.dart';
import '../doctor_validator.dart';
import 'vscode.dart';
class VsCodeValidator extends DoctorValidator {
VsCodeValidator(this._vsCode) : super(_vsCode.productName);
final VsCode _vsCode;
static Iterable<DoctorValidator> installedValidators(FileSystem fileSystem, Platform platform, ProcessManager processManager) {
return VsCode
.allInstalled(fileSystem, platform, processManager)
.map<DoctorValidator>((VsCode vsCode) => VsCodeValidator(vsCode));
}
@override
Future<ValidationResult> validate() async {
final List<ValidationMessage> validationMessages =
List<ValidationMessage>.from(_vsCode.validationMessages);
final String vsCodeVersionText = _vsCode.version == null
? userMessages.vsCodeVersion('unknown')
: userMessages.vsCodeVersion(_vsCode.version.toString());
if (_vsCode.version == null) {
validationMessages.add(const ValidationMessage.error('Unable to determine VS Code version.'));
}
return ValidationResult(
ValidationType.success,
validationMessages,
statusInfo: vsCodeVersionText,
);
}
}