Offline data mode causes isFlutterApp to fail with `Null check operator used on a null value`
This code in connected_app.dart fails for connected controllers, when loading saved data:
Future<bool> get isFlutterApp async => _isFlutterApp ??=
await serviceManager!.libraryUriAvailable(flutterLibraryUri);
It is expected that connected controller should function as normal in offline data mode.
cc @kenzieschmoll
Can you provide repro steps? Also, could this have been caused by hot restart robustness issues on web?
Steps to repro:
- Checkout DevTools at ef553c729ca9bd6cabb494fa8551fcd9a0797bb1
- Connect to an app
- Open memory screen
- Open the data: dart_devtools_2024-05-06_17:44:43.187.json
- See the error printed in debug console
flutter: Null check operator used on a null value
flutter: #0 ConnectedApp.isFlutterApp (package:devtools_app_shared/src/service/connected_app.dart:54:27)
#1 ServiceConnectionManager.rasterCacheMetrics (package:devtools_app/src/service/service_manager.dart:267:35)
#2 MemoryTracker._fetchRasterCacheInfo (package:devtools_app/src/screens/memory/panes/chart/controller/memory_tracker.dart:156:46)
#3 MemoryTracker.pollMemory (package:devtools_app/src/screens/memory/panes/chart/controller/memory_tracker.dart:111:25)
<asynchronous suspension>
#4 ChartVmConnection.init.<anonymous closure> (package:devtools_app/src/screens/memory/panes/chart/controller/chart_connection.dart:81:11)
<asynchronous suspension>
#5 DebounceTimer._runCallback (package:devtools_app/src/shared/utils.dart:264:7)
<asynchronous suspension>
It also repro on master, but you need to add debug prints before rethrow to see the error.
This issue is caused by the fact that we replace the service manager's connected app with the offline connected app. But on the route underneath the current route showing the offline data, the "online" screen still expects the real connected app.