Repository navigation
[tool] Migrate CreateCommand to modular dependency injection - #190785
Conversation
0ff277c to
49a9979
Compare
There was a problem hiding this comment.
Code Review
This pull request refactors CreateCommand and CreateBase to accept and use a ToolContext instead of accessing global variables directly, updating the command instantiation and associated tests accordingly. Feedback on the changes suggests making toolContext a required parameter in WidgetPreviewCommand, WidgetPreviewSubCommandBase, and WidgetPreviewStartCommand to enforce compile-time null safety and prevent potential runtime null assertion crashes.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request refactors CreateCommand, WidgetPreviewCommand, and the CreateBase mixin to accept and utilize ToolContext for dependency injection, replacing references to global variables. Corresponding unit and integration tests are updated to supply a ToolContext during command instantiation. The review feedback suggests further simplifying the WidgetPreviewCommand constructor, its instantiation in executable.dart, and its test setup by removing redundant individual dependency parameters that can be directly extracted from the newly required ToolContext.
|
/gemini review |
|
Looks like the g3fix needs to be updated for this PR. |
Fixed now! |
dcharkes
left a comment
There was a problem hiding this comment.
reapproving rebased+deps-bumped+formatted+linted.
Summary
Part 18 of the modular dependency injection migration.
CreateCommand,CreateBase, andWidgetPreviewCommandto modular constructor dependency injection with zero fallbacks:CreateCommand({required ToolContext toolContext, required this.androidContext, required this.appleContext, ExtensionTemplateManager? extensionTemplateManager, required TemplateRenderer templateRenderer, bool verboseHelp = false})WidgetPreviewCommand({required ShutdownHooks shutdownHooks, required ToolContext toolContext, required bool verboseHelp, ...})ToolContext,AndroidContext,AppleContext) andTemplateRenderer, eliminating individual constructor fallback parameters and ambientglobals.*.packages/flutter_tools/test/commands.shard/hermetic/create_usage_test.dartto hermetictestWithoutContext.Part of #188471