Skip to content
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

Hide the DevTools provider screen when the provider DevTools extension is available #6274

Merged
merged 1 commit into from
Aug 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions packages/devtools_app/lib/src/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,22 @@ class DevToolsApp extends StatefulWidget {
/// This manages the route generation, and marshals URL query parameters into
/// flutter route parameters.
class DevToolsAppState extends State<DevToolsApp> with AutoDisposeMixin {
List<Screen> get _screens => [
..._originalScreens,
if (FeatureFlags.devToolsExtensions) ..._extensionScreens,
];
List<Screen> get _screens {
if (FeatureFlags.devToolsExtensions) {
// TODO(https://github.com/flutter/devtools/issues/6273): stop special
// casing the package:provider extension.
final containsProviderExtension = extensionService.visibleExtensions.value
.where((e) => e.name == 'provider')
.isNotEmpty;
final devToolsScreens = containsProviderExtension
? _originalScreens
.where((s) => s.screenId != ScreenMetaData.provider.id)
.toList()
: _originalScreens;
return [...devToolsScreens, ..._extensionScreens];
}
return _originalScreens;
}

List<Screen> get _originalScreens =>
widget.originalScreens.map((s) => s.screen).toList();
Expand Down