-
Notifications
You must be signed in to change notification settings - Fork 355
Add feature flag scaffolding to support experiments restricted to a specific Flutter channel #9440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
/// | ||
/// https://github.com/flutter/devtools/issues/7002 | ||
static bool memoryObserver = true; | ||
static BooleanFeatureFlag memoryObserver = BooleanFeatureFlag( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can these be final?
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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 bool
s 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 😅
There was a problem hiding this comment.
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:
- 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
- because I think
if (FeatureFlags.flagName.isEnabled)
is clearer thanif (FeatureFlags.flagName)
- so that you call isEnabled for both the boolean feature flags and the versioned feature flags.
There was a problem hiding this comment.
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)
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 thebeta
channel or adev
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).