Fix a TODO to use String utilities and remove stale TODOs (#9695)
diff --git a/packages/devtools_app/lib/src/screens/debugger/codeview_controller.dart b/packages/devtools_app/lib/src/screens/debugger/codeview_controller.dart
index a937cf8..5336255 100644
--- a/packages/devtools_app/lib/src/screens/debugger/codeview_controller.dart
+++ b/packages/devtools_app/lib/src/screens/debugger/codeview_controller.dart
@@ -19,6 +19,7 @@
 import '../../shared/globals.dart';
 import '../../shared/managers/notifications.dart';
 import '../../shared/primitives/history_manager.dart';
+import '../../shared/primitives/utils.dart';
 import '../../shared/ui/search.dart';
 import '../../shared/utils/utils.dart';
 import '../vm_developer/vm_service_private_extensions.dart';
@@ -419,12 +420,11 @@
       return [];
     }
     final matches = <SourceToken>[];
-    final caseInsensitiveSearch = search.toLowerCase();
 
     final currentScript = parsedScript.value!;
     for (int i = 0; i < currentScript.lines.length; i++) {
-      final line = currentScript.lines[i].toLowerCase();
-      final matchesForLine = caseInsensitiveSearch.allMatches(line);
+      final line = currentScript.lines[i];
+      final matchesForLine = search.caseInsensitiveAllMatches(line);
       if (matchesForLine.isNotEmpty) {
         matches.addAll(
           matchesForLine.map(
diff --git a/packages/devtools_app/lib/src/screens/memory/panes/tracing/tracing_data.dart b/packages/devtools_app/lib/src/screens/memory/panes/tracing/tracing_data.dart
index 10c6937..2fe270c 100644
--- a/packages/devtools_app/lib/src/screens/memory/panes/tracing/tracing_data.dart
+++ b/packages/devtools_app/lib/src/screens/memory/panes/tracing/tracing_data.dart
@@ -89,9 +89,8 @@
       '${clazz.name} instances: $instances trace: $traceAllocations';
 }
 
-// TODO(kenz): include the selected class in the toJson and fromJson methods.
 @visibleForTesting
-enum TracingIsolateStateJson { isolate, classes, profiles }
+enum TracingIsolateStateJson { isolate, classes, profiles, selectedClass }
 
 /// Contains allocation tracing state for a single isolate.
 ///
@@ -107,6 +106,9 @@
     this.classes = classes ?? [];
     classesById = {for (final e in this.classes) e.clazz.id!: e};
     this.profiles = profiles ?? {};
+    if (selectedClass != null) {
+      this.selectedClass.value = classesById[selectedClass];
+    }
   }
 
   TracingIsolateState.empty() : this(isolate: IsolateRef());
@@ -125,6 +127,8 @@
       classes: (json[TracingIsolateStateJson.classes.name] as List)
           .map((e) => deserialize<TracedClass>(e, TracedClass.fromJson))
           .toList(),
+      selectedClass:
+          json[TracingIsolateStateJson.selectedClass.name] as String?,
     );
   }
 
@@ -134,6 +138,9 @@
       TracingIsolateStateJson.isolate.name: isolate,
       TracingIsolateStateJson.classes.name: classesById.values.toList(),
       TracingIsolateStateJson.profiles.name: profiles,
+      if (selectedClass.value != null)
+        TracingIsolateStateJson.selectedClass.name:
+            selectedClass.value!.clazz.id!,
     };
   }
 
diff --git a/packages/devtools_app/lib/src/shared/primitives/utils.dart b/packages/devtools_app/lib/src/shared/primitives/utils.dart
index 3da3540..a1073e8 100644
--- a/packages/devtools_app/lib/src/shared/primitives/utils.dart
+++ b/packages/devtools_app/lib/src/shared/primitives/utils.dart
@@ -945,8 +945,6 @@
 }
 
 // TODO(kenz): consider moving other String helpers into this extension.
-// TODO(kenz): replace other uses of toLowerCase() for string matching with
-// this extension method.
 extension StringExtension on String {
   bool caseInsensitiveContains(Pattern? pattern) {
     if (pattern is RegExp) {
diff --git a/packages/devtools_app/lib/src/shared/ui/search.dart b/packages/devtools_app/lib/src/shared/ui/search.dart
index af947d5..cce6437 100644
--- a/packages/devtools_app/lib/src/shared/ui/search.dart
+++ b/packages/devtools_app/lib/src/shared/ui/search.dart
@@ -1248,10 +1248,9 @@
         String? foundExact;
 
         // What the user has typed in so far.
-        final searchToMatch = widget.controller.search.toLowerCase();
         // Find exact match in autocomplete list - use that as our search value.
         for (final autoEntry in widget.controller.searchAutoComplete.value) {
-          if (searchToMatch == autoEntry.text.toLowerCase()) {
+          if (autoEntry.text.caseInsensitiveEquals(widget.controller.search)) {
             foundExact = autoEntry.text;
             break;
           }
diff --git a/packages/devtools_app/lib/src/shared/ui/vm_flag_widgets.dart b/packages/devtools_app/lib/src/shared/ui/vm_flag_widgets.dart
index f04b40b..187ebff 100644
--- a/packages/devtools_app/lib/src/shared/ui/vm_flag_widgets.dart
+++ b/packages/devtools_app/lib/src/shared/ui/vm_flag_widgets.dart
@@ -183,11 +183,13 @@
   }
 
   void _refilter() {
-    final filter = filterController.text.trim().toLowerCase();
+    final filter = filterController.text.trim();
 
     filteredFlags = filter.isEmpty
         ? flags
-        : flags.where((flag) => flag.filterText.contains(filter)).toList();
+        : flags
+              .where((flag) => flag.filterText.caseInsensitiveContains(filter))
+              .toList();
   }
 
   @override
diff --git a/packages/devtools_extensions/lib/src/template/_simulated_devtools_environment/_simulated_devtools_environment.dart b/packages/devtools_extensions/lib/src/template/_simulated_devtools_environment/_simulated_devtools_environment.dart
index d2bd958..1305aab 100644
--- a/packages/devtools_extensions/lib/src/template/_simulated_devtools_environment/_simulated_devtools_environment.dart
+++ b/packages/devtools_extensions/lib/src/template/_simulated_devtools_environment/_simulated_devtools_environment.dart
@@ -207,8 +207,6 @@
                 label: 'FORCE RELOAD',
                 onPressed: simController.forceReload,
               ),
-              // TODO(kenz): add buttons for other simulated events as the extension
-              // API expands.
             ],
           ),
           const SizedBox(height: defaultSpacing),
diff --git a/packages/devtools_shared/lib/src/server/server_api.dart b/packages/devtools_shared/lib/src/server/server_api.dart
index 5254041..6d27c66 100644
--- a/packages/devtools_shared/lib/src/server/server_api.dart
+++ b/packages/devtools_shared/lib/src/server/server_api.dart
@@ -26,8 +26,6 @@
 import 'file_system.dart';
 import 'flutter_store.dart';
 
-// TODO(kenz): consider using Dart augmentation libraries instead of part files
-// if there is a clear benefit.
 part 'handlers/_app_size.dart';
 part 'handlers/_deeplink.dart';
 part 'handlers/_devtools_extensions.dart';