Skip to content

Commit

Permalink
Hide the DevTools provider screen when the provider DevTools extensio…
Browse files Browse the repository at this point in the history
…n is available (#6274)
  • Loading branch information
kenzieschmoll authored Aug 29, 2023
1 parent 34f95a2 commit 8c2e8c5
Showing 1 changed file with 16 additions and 4 deletions.
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

0 comments on commit 8c2e8c5

Please sign in to comment.