[ DDS ] Fix a null safety error in memory_profile.dart

See https://github.com/flutter/flutter/issues/97588

Bug: 97588
Change-Id: I95fc1b50b936b7d15d674cc7e1c6908975989d47
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231533
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
diff --git a/pkg/dds/lib/src/devtools/memory_profile.dart b/pkg/dds/lib/src/devtools/memory_profile.dart
index da6fa61..03fe5c1 100644
--- a/pkg/dds/lib/src/devtools/memory_profile.dart
+++ b/pkg/dds/lib/src/devtools/memory_profile.dart
@@ -8,6 +8,7 @@
 import 'dart:async';
 import 'dart:io' as io;
 
+import 'package:collection/collection.dart';
 import 'package:devtools_shared/devtools_shared.dart';
 import 'package:vm_service/vm_service.dart';
 
@@ -227,9 +228,8 @@
         flutterViewListResponse.json!['views'].cast<Map<String, dynamic>>();
 
     // Each isolate should only have one FlutterView.
-    final flutterView = views.firstWhere(
+    final flutterView = views.firstWhereOrNull(
       (view) => view['type'] == 'FlutterView',
-      orElse: () => null,
     );
 
     if (flutterView == null) {