Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

elliette
Copy link
Member

Work towards #9438

Previously all feature flags in DevTools could only be controlled by a boolean. This PR allows us to specify a Flutter channel to enable a feature for (e.g. beta will enable the experiment if a user is on the beta channel or a dev branch of Flutter). See #9439 for why this is using Flutter instead of Dart channels.

FYI @kevmoo @mdebbar @natebiggs - This will allow us to enable dart2wasm compilation for everyone on Flutter beta now (which will go out on Oct 15th) without having to wait for the next beta after Flutter 3.38 (which will go out on November 12th).

@elliette elliette requested a review from srawlins September 18, 2025 23:27
@elliette elliette requested review from kenzieschmoll, bkonyi and a team as code owners September 18, 2025 23:27
///
/// https://github.com/flutter/devtools/issues/7002
static bool memoryObserver = true;
static BooleanFeatureFlag memoryObserver = BooleanFeatureFlag(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can these be final?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops yes they should be. will change!

}

/// A simple feature flag that is enabled or disabled by a boolean value.
class BooleanFeatureFlag {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any particular reason for doing this instead of just using bools for trivial feature flags? It feels like this is achieving the same thing, just with extra steps.

I am reviewing on mobile, so I could have very well missed something obvious, so I hope this isn't a silly question 😅

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not silly! I changed it but then wondered if it was an improvement or not lol.

My reasoning for changing it was:

  1. to tie the name to the flag, instead of having to specify it in what was then a map and is now a set of all the flags
  2. because I think if (FeatureFlags.flagName.isEnabled) is clearer than if (FeatureFlags.flagName)
  3. so that you call isEnabled for both the boolean feature flags and the versioned feature flags.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(One belated thought is previously the feature flag values could be changed elsewhere in code (e.g. FeatureFlags.flagName = false, this prevents that from happening)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants