Skip to content

Commit

Permalink
added isNullOrEmpty check
Browse files Browse the repository at this point in the history
  • Loading branch information
hrajwade96 committed Oct 3, 2024
1 parent 857cfbe commit 7150436
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ class NetworkController extends DisposableController
await maybeLoadOfflineData(
NetworkScreen.id,
createData: (json) => OfflineNetworkData.fromJson(json),
shouldLoad: (data) => data != null,
shouldLoad: (data) => !data.isEmpty,
loadData: (data) => loadOfflineData(data),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'dart:convert';
import 'package:devtools_shared/devtools_shared.dart';

import '../../shared/http/http_request_data.dart';
import '../../shared/primitives/utils.dart';

/// Class to encapsulate offline data for the [NetworkController].
/// It is responsible for serializing and deserializing offline network data.
Expand Down Expand Up @@ -36,6 +37,7 @@ class OfflineNetworkData with Serializable {
recording: json['recording'] as bool? ?? false,
);
}
bool get isEmpty => requests.isNullOrEmpty;

/// List of current [DartIOHttpRequestData] network requests.
final List<DartIOHttpRequestData> requests;
Expand Down

0 comments on commit 7150436

Please sign in to comment.