loadPlacesWithState function
Loads all places (local and pod) with optional encrypted places.
Implementation
Future<LoadPlacesResult> loadPlacesWithState({
required List<Place> currentPlaces,
required bool forceRefresh,
required bool includeEncrypted,
}) async {
final cacheManager = PlacesCacheManager();
final showLoading = cacheManager.allPlaces == null;
final places = await loadAllPlaces(
forceRefresh: forceRefresh,
includeEncrypted: includeEncrypted,
);
// Check if data actually changed to avoid unnecessary rebuild.
final hasChanges =
currentPlaces.length != places.length ||
!currentPlaces.every((p) => places.any((np) => np.id == p.id));
return LoadPlacesResult(
places: places,
showLoading: showLoading,
hasChanges: hasChanges || showLoading,
);
}