Skip to content

Commit 14b3f74

Browse files
authored
flutter_tool: DRY up features that are fully enabled (#121754)
flutter_tool: DRY up features that are fully enabled
1 parent b85f195 commit 14b3f74

File tree

1 file changed

+25
-79
lines changed

1 file changed

+25
-79
lines changed

packages/flutter_tools/lib/src/features.dart

Lines changed: 25 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -67,116 +67,43 @@ const List<Feature> allFeatures = <Feature>[
6767
];
6868

6969
/// The [Feature] for flutter web.
70-
const Feature flutterWebFeature = Feature(
70+
const Feature flutterWebFeature = Feature.fullyEnabled(
7171
name: 'Flutter for web',
7272
configSetting: 'enable-web',
7373
environmentOverride: 'FLUTTER_WEB',
74-
master: FeatureChannelSetting(
75-
available: true,
76-
enabledByDefault: true,
77-
),
78-
beta: FeatureChannelSetting(
79-
available: true,
80-
enabledByDefault: true,
81-
),
82-
stable: FeatureChannelSetting(
83-
available: true,
84-
enabledByDefault: true,
85-
),
8674
);
8775

8876
/// The [Feature] for macOS desktop.
89-
const Feature flutterMacOSDesktopFeature = Feature(
77+
const Feature flutterMacOSDesktopFeature = Feature.fullyEnabled(
9078
name: 'support for desktop on macOS',
9179
configSetting: 'enable-macos-desktop',
9280
environmentOverride: 'FLUTTER_MACOS',
93-
master: FeatureChannelSetting(
94-
available: true,
95-
enabledByDefault: true,
96-
),
97-
beta: FeatureChannelSetting(
98-
available: true,
99-
enabledByDefault: true,
100-
),
101-
stable: FeatureChannelSetting(
102-
available: true,
103-
enabledByDefault: true,
104-
),
10581
);
10682

10783
/// The [Feature] for Linux desktop.
108-
const Feature flutterLinuxDesktopFeature = Feature(
84+
const Feature flutterLinuxDesktopFeature = Feature.fullyEnabled(
10985
name: 'support for desktop on Linux',
11086
configSetting: 'enable-linux-desktop',
11187
environmentOverride: 'FLUTTER_LINUX',
112-
master: FeatureChannelSetting(
113-
available: true,
114-
enabledByDefault: true,
115-
),
116-
beta: FeatureChannelSetting(
117-
available: true,
118-
enabledByDefault: true,
119-
),
120-
stable: FeatureChannelSetting(
121-
available: true,
122-
enabledByDefault: true,
123-
),
12488
);
12589

12690
/// The [Feature] for Windows desktop.
127-
const Feature flutterWindowsDesktopFeature = Feature(
91+
const Feature flutterWindowsDesktopFeature = Feature.fullyEnabled(
12892
name: 'support for desktop on Windows',
12993
configSetting: 'enable-windows-desktop',
13094
environmentOverride: 'FLUTTER_WINDOWS',
131-
master: FeatureChannelSetting(
132-
available: true,
133-
enabledByDefault: true,
134-
),
135-
beta: FeatureChannelSetting(
136-
available: true,
137-
enabledByDefault: true,
138-
),
139-
stable: FeatureChannelSetting(
140-
available: true,
141-
enabledByDefault: true,
142-
),
14395
);
14496

14597
/// The [Feature] for Android devices.
146-
const Feature flutterAndroidFeature = Feature(
98+
const Feature flutterAndroidFeature = Feature.fullyEnabled(
14799
name: 'Flutter for Android',
148100
configSetting: 'enable-android',
149-
master: FeatureChannelSetting(
150-
available: true,
151-
enabledByDefault: true,
152-
),
153-
beta: FeatureChannelSetting(
154-
available: true,
155-
enabledByDefault: true,
156-
),
157-
stable: FeatureChannelSetting(
158-
available: true,
159-
enabledByDefault: true,
160-
),
161101
);
162102

163-
164103
/// The [Feature] for iOS devices.
165-
const Feature flutterIOSFeature = Feature(
104+
const Feature flutterIOSFeature = Feature.fullyEnabled(
166105
name: 'Flutter for iOS',
167106
configSetting: 'enable-ios',
168-
master: FeatureChannelSetting(
169-
available: true,
170-
enabledByDefault: true,
171-
),
172-
beta: FeatureChannelSetting(
173-
available: true,
174-
enabledByDefault: true,
175-
),
176-
stable: FeatureChannelSetting(
177-
available: true,
178-
enabledByDefault: true,
179-
),
180107
);
181108

182109
/// The [Feature] for Fuchsia support.
@@ -238,6 +165,25 @@ class Feature {
238165
this.stable = const FeatureChannelSetting()
239166
});
240167

168+
/// Creates a [Feature] that is fully enabled across channels.
169+
const Feature.fullyEnabled(
170+
{required this.name,
171+
this.environmentOverride,
172+
this.configSetting,
173+
this.extraHelpText})
174+
: master = const FeatureChannelSetting(
175+
available: true,
176+
enabledByDefault: true,
177+
),
178+
beta = const FeatureChannelSetting(
179+
available: true,
180+
enabledByDefault: true,
181+
),
182+
stable = const FeatureChannelSetting(
183+
available: true,
184+
enabledByDefault: true,
185+
);
186+
241187
/// The user visible name for this feature.
242188
final String name;
243189

0 commit comments

Comments
 (0)