[flutter_tools] remove context from WebWorkflow (#52613)

This commit is contained in:
Jonah Williams
2020-03-16 11:33:00 -07:00
committed by GitHub
parent 48fc135003
commit 028b7dced1
5 changed files with 83 additions and 118 deletions

View File

@@ -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;