Skip to content

Commit

Permalink
use locals to avoid error
Browse files Browse the repository at this point in the history
  • Loading branch information
kenzieschmoll committed Nov 7, 2023
1 parent 11c4fb9 commit 789f0e6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -828,10 +828,10 @@ class NavigationInfo {

final Map<String, dynamic>? _route;

String? get routeDescription =>
// ignore: unnecessary_non_null_assertion, causing error on bots, but not
// locally. Need to investigate further.
_route == null ? null : _route!['description'];
String? get routeDescription {
final routeLocal = _route;
return routeLocal == null ? null : routeLocal['description'];
}
}

class ServiceExtensionStateChangedInfo {
Expand Down
28 changes: 12 additions & 16 deletions packages/devtools_test/lib/src/mocks/fake_vm_service_wrapper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,9 @@ class FakeVmServiceWrapper extends Fake implements VmServiceWrapper {
cpuSamples = cpuSamples ?? _defaultProfile,
allocationSamples = allocationSamples ?? _defaultProfile {
_reverseResolvedUriMap = <String, String>{};
if (_resolvedUriMap != null) {
// ignore: unnecessary_non_null_assertion, causing error on bots, but not
// locally. Need to investigate.
for (var e in _resolvedUriMap!.entries) {
final resolvedUrlMapLocal = _resolvedUriMap;
if (resolvedUrlMapLocal != null) {
for (var e in resolvedUrlMapLocal.entries) {
_reverseResolvedUriMap![e.value] = e.key;
}
}
Expand Down Expand Up @@ -126,12 +125,11 @@ class FakeVmServiceWrapper extends Fake implements VmServiceWrapper {

@override
Future<UriList> lookupPackageUris(String isolateId, List<String> uris) {
final resolvedUrlMapLocal = _resolvedUriMap;
return Future.value(
UriList(
uris: _resolvedUriMap != null
// ignore: unnecessary_non_null_assertion, causing error on bots,
// but not locally. Need to investigate.
? (uris.map((e) => _resolvedUriMap![e]).toList())
uris: resolvedUrlMapLocal != null
? (uris.map((e) => resolvedUrlMapLocal[e]).toList())
: null,
),
);
Expand All @@ -143,12 +141,11 @@ class FakeVmServiceWrapper extends Fake implements VmServiceWrapper {
List<String> uris, {
bool? local,
}) {
final resolvedUrlMapLocal = _resolvedUriMap;
return Future.value(
UriList(
// ignore: unnecessary_non_null_assertion, causing error on bots, but
// not locally. Need to investigate.
uris: _reverseResolvedUriMap != null
? (uris.map((e) => _reverseResolvedUriMap![e]).toList())
uris: resolvedUrlMapLocal != null
? (uris.map((e) => resolvedUrlMapLocal[e]).toList())
: null,
),
);
Expand Down Expand Up @@ -276,13 +273,12 @@ class FakeVmServiceWrapper extends Fake implements VmServiceWrapper {

@override
Future<MemoryUsage> getMemoryUsage(String isolateId) {
if (_memoryData == null) {
final memoryDataLocal = _memoryData;
if (memoryDataLocal == null) {
throw StateError('_memoryData was not provided to FakeServiceManager');
}

// ignore: unnecessary_non_null_assertion, causing error on bots, but not
// locally. Need to investigate.
final heapSample = _memoryData!.data.first;
final heapSample = memoryDataLocal.data.first;
return Future.value(
MemoryUsage(
externalUsage: heapSample.external,
Expand Down

0 comments on commit 789f0e6

Please sign in to comment.