alexeyinkin commented on code in PR #23378:
URL: https://github.com/apache/beam/pull/23378#discussion_r982167249


##########
playground/frontend/playground_components/lib/src/playground_components.dart:
##########
@@ -26,4 +30,11 @@ class PlaygroundComponents {
     packageName,
     path: 'assets/translations',
   );
+
+  static Future<void> ensureInitialized() async {
+    await initializeServiceLocator();
+  }
+
+  static SymbolsNotifier get symbolsNotifier =>
+      GetIt.instance.get<SymbolsNotifier>();

Review Comment:
   This is more of a service locator than a dependency injection. SL's objects 
are a form of global variables while provider is a mean to make something 
available to a subtree.
   
   Provider should be used if it makes sense to override an object to certain 
parts of the tree. For instance, we do this with themes in 'Share my code' 
button.
   
   For objects that are global by design, hanging them with provider adds 
complexity to their management. Also with SL objects are available in other 
business logic objects and not only in widgets.
   
   `SymbolsNotifier` will be used in `SnippetEditingController`. Passing it 
though widgets is way more complex than just using a global instance with 
`get_it`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to