getAlbumsWithPhotos method
Implementation
@override
Future<AlbumResponse> getAlbumsWithPhotos(
ServiceCall call, AlbumRequest request) async {
if (request.id > 0) {
final album = findAlbums(request.id)[0];
final albumPhotos = findPhotos(album.id);
return AlbumResponse()..albums.add(album..photos.addAll(albumPhotos));
}
return AlbumResponse()
..albums.addAll(albums.map((json) {
final album = convertToAlbum(json);
final albumPhotos = findPhotos(album.id);
return album..photos.addAll(albumPhotos);
}));
}