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


##########
playground/frontend/playground_components/lib/src/services/symbols/symbols_notifier.dart:
##########
@@ -0,0 +1,36 @@
+import 'dart:async';
+
+import 'package:flutter/widgets.dart';
+import 'package:highlight/highlight_core.dart';
+
+import '../../models/symbols_dictionary.dart';
+import 'loaders/abstract.dart';
+
+class SymbolsNotifier extends ChangeNotifier {
+  final _dictionaryFuturesByByMode = <Mode, Future<SymbolsDictionary>>{};
+  final _dictionariesByMode = <Mode, SymbolsDictionary>{};
+
+  void addLoader(Mode mode, AbstractSymbolsLoader loader) {
+    unawaited(_load(mode, loader));
+  }
+
+  Future<SymbolsDictionary> _load(
+    Mode mode,
+    AbstractSymbolsLoader loader,
+  ) async {
+    final future = _dictionaryFuturesByByMode[mode];
+
+    if (future != null) {
+      return future;
+    }
+
+    _dictionaryFuturesByByMode[mode] = loader.future;
+
+    final dictionary = await loader.future;
+    _dictionariesByMode[mode] = dictionary;
+    notifyListeners();
+    return dictionary;
+  }
+
+  SymbolsDictionary? getDictionary(Mode mode) => _dictionariesByMode[mode];

Review Comment:
   It's in the WIP that will replace the editor with ours.



-- 
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