mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request. ### Issue Link: Part 2 of https://github.com/flutter/flutter/issues/144218 ### Changelog Description: Explain this cherry pick in one line that is accessible to most Flutter developers. See [best practices](https://github.com/flutter/flutter/blob/main/docs/releases/Hotfix-Documentation-Best-Practices.md) for examples Implementation of a future fix to allow Xcode 26 to `flutter run` twice in a row. ### Impact Description: What is the impact (ex. visual jank on Samsung phones, app crash, cannot ship an iOS app)? Does it impact development (ex. flutter doctor crashes when Android Studio is installed), or the shipping production app (the app crashes on launch) Flutter developers running Xcode 26 can `flutter run` to a tethered iOS device once. However subsequent `flutter run` attempts are likely to fail. ### Workaround: Is there a workaround for this issue? Quitting and reopening Xcode. ### Risk: What is the risk level of this cherry-pick? ### Test Coverage: Are you confident that your fix is well-tested by automated tests? ### Validation Steps: What are the steps to validate that this fix works? Create a flutter project and run `flutter run` twice in a row with a physical iOS 17+ device and Xcode 26.
91 lines
2.5 KiB
Dart
91 lines
2.5 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:meta/meta.dart';
|
|
|
|
import 'base/platform.dart';
|
|
import 'features.dart';
|
|
import 'flutter_features_config.dart';
|
|
import 'version.dart';
|
|
|
|
@visibleForTesting
|
|
mixin FlutterFeatureFlagsIsEnabled implements FeatureFlags {
|
|
@protected
|
|
Platform get platform;
|
|
|
|
@override
|
|
bool get isLinuxEnabled => isEnabled(flutterLinuxDesktopFeature);
|
|
|
|
@override
|
|
bool get isMacOSEnabled => isEnabled(flutterMacOSDesktopFeature);
|
|
|
|
@override
|
|
bool get isWebEnabled => isEnabled(flutterWebFeature);
|
|
|
|
@override
|
|
bool get isWindowsEnabled => isEnabled(flutterWindowsDesktopFeature);
|
|
|
|
@override
|
|
bool get isAndroidEnabled => isEnabled(flutterAndroidFeature);
|
|
|
|
@override
|
|
bool get isIOSEnabled => isEnabled(flutterIOSFeature);
|
|
|
|
@override
|
|
bool get isFuchsiaEnabled => isEnabled(flutterFuchsiaFeature);
|
|
|
|
@override
|
|
bool get areCustomDevicesEnabled => isEnabled(flutterCustomDevicesFeature);
|
|
|
|
@override
|
|
bool get isCliAnimationEnabled {
|
|
if (platform.environment['TERM'] == 'dumb') {
|
|
return false;
|
|
}
|
|
return isEnabled(cliAnimation);
|
|
}
|
|
|
|
@override
|
|
bool get isNativeAssetsEnabled => isEnabled(nativeAssets);
|
|
|
|
@override
|
|
bool get isSwiftPackageManagerEnabled => isEnabled(swiftPackageManager);
|
|
|
|
@override
|
|
bool get isOmitLegacyVersionFileEnabled => isEnabled(omitLegacyVersionFile);
|
|
|
|
@override
|
|
bool get isLLDBDebuggingEnabled => isEnabled(lldbDebugging);
|
|
}
|
|
|
|
interface class FlutterFeatureFlags extends FeatureFlags with FlutterFeatureFlagsIsEnabled {
|
|
FlutterFeatureFlags({
|
|
required FlutterVersion flutterVersion,
|
|
required FlutterFeaturesConfig featuresConfig,
|
|
required this.platform,
|
|
}) : _flutterVersion = flutterVersion,
|
|
_featuresConfig = featuresConfig;
|
|
|
|
final FlutterVersion _flutterVersion;
|
|
final FlutterFeaturesConfig _featuresConfig;
|
|
|
|
@override
|
|
@protected
|
|
final Platform platform;
|
|
|
|
@override
|
|
bool isEnabled(Feature feature) {
|
|
final String currentChannel = _flutterVersion.channel;
|
|
final FeatureChannelSetting featureSetting = feature.getSettingForChannel(currentChannel);
|
|
|
|
// If unavailable, then no setting can enable this feature.
|
|
if (!featureSetting.available) {
|
|
return false;
|
|
}
|
|
|
|
// Otherwise, read it from environment variable > project manifest > global config
|
|
return _featuresConfig.isEnabled(feature) ?? featureSetting.enabledByDefault;
|
|
}
|
|
}
|