[flutter_tools] remove context from WebWorkflow (#52613)
This commit is contained in:
@@ -197,7 +197,10 @@ Future<T> runInContext<T>(
|
||||
processManager: globals.processManager,
|
||||
)
|
||||
),
|
||||
WebWorkflow: () => const WebWorkflow(),
|
||||
WebWorkflow: () => WebWorkflow(
|
||||
featureFlags: featureFlags,
|
||||
platform: globals.platform,
|
||||
),
|
||||
WindowsWorkflow: () => const WindowsWorkflow(),
|
||||
Xcode: () => Xcode(
|
||||
logger: globals.logger,
|
||||
|
||||
@@ -56,6 +56,16 @@ class _DefaultDoctorValidatorsProvider implements DoctorValidatorsProvider {
|
||||
List<DoctorValidator> _validators;
|
||||
List<Workflow> _workflows;
|
||||
|
||||
final LinuxWorkflow linuxWorkflow = LinuxWorkflow(
|
||||
platform: globals.platform,
|
||||
featureFlags: featureFlags,
|
||||
);
|
||||
|
||||
final WebWorkflow webWorkflow = WebWorkflow(
|
||||
platform: globals.platform,
|
||||
featureFlags: featureFlags,
|
||||
);
|
||||
|
||||
@override
|
||||
List<DoctorValidator> get validators {
|
||||
if (_validators != null) {
|
||||
@@ -67,11 +77,6 @@ class _DefaultDoctorValidatorsProvider implements DoctorValidatorsProvider {
|
||||
...IntelliJValidator.installedValidators,
|
||||
...VsCodeValidator.installedValidators,
|
||||
];
|
||||
final LinuxWorkflow linuxWorkflow = LinuxWorkflow(
|
||||
platform: globals.platform,
|
||||
featureFlags: featureFlags,
|
||||
);
|
||||
|
||||
_validators = <DoctorValidator>[
|
||||
FlutterValidator(),
|
||||
if (androidWorkflow.appliesToHostPlatform)
|
||||
@@ -119,10 +124,6 @@ class _DefaultDoctorValidatorsProvider implements DoctorValidatorsProvider {
|
||||
_workflows.add(fuchsiaWorkflow);
|
||||
}
|
||||
|
||||
final LinuxWorkflow linuxWorkflow = LinuxWorkflow(
|
||||
platform: globals.platform,
|
||||
featureFlags: featureFlags,
|
||||
);
|
||||
if (linuxWorkflow.appliesToHostPlatform) {
|
||||
_workflows.add(linuxWorkflow);
|
||||
}
|
||||
|
||||
@@ -2,25 +2,33 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import '../base/context.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:platform/platform.dart';
|
||||
|
||||
import '../doctor.dart';
|
||||
import '../features.dart';
|
||||
import '../globals.dart' as globals;
|
||||
|
||||
/// The web workflow instance.
|
||||
WebWorkflow get webWorkflow => context.get<WebWorkflow>();
|
||||
|
||||
class WebWorkflow extends Workflow {
|
||||
const WebWorkflow();
|
||||
const WebWorkflow({
|
||||
@required Platform platform,
|
||||
@required FeatureFlags featureFlags,
|
||||
}) : _platform = platform,
|
||||
_featureFlags = featureFlags;
|
||||
|
||||
final Platform _platform;
|
||||
final FeatureFlags _featureFlags;
|
||||
|
||||
@override
|
||||
bool get appliesToHostPlatform => featureFlags.isWebEnabled && (globals.platform.isWindows || globals.platform.isMacOS || globals.platform.isLinux);
|
||||
bool get appliesToHostPlatform => _featureFlags.isWebEnabled &&
|
||||
(_platform.isWindows ||
|
||||
_platform.isMacOS ||
|
||||
_platform.isLinux);
|
||||
|
||||
@override
|
||||
bool get canLaunchDevices => featureFlags.isWebEnabled;
|
||||
bool get canLaunchDevices => _featureFlags.isWebEnabled;
|
||||
|
||||
@override
|
||||
bool get canListDevices => featureFlags.isWebEnabled;
|
||||
bool get canListDevices => _featureFlags.isWebEnabled;
|
||||
|
||||
@override
|
||||
bool get canListEmulators => false;
|
||||
|
||||
Reference in New Issue
Block a user