getUserAlbums method Null safety

  1. @override
Future<Result<List<Album>>> getUserAlbums(
  1. UserId userId
)
override

Returns result with all photo albums from a given user.

Implementation

@override
Future<Result<List<Album>>> getUserAlbums(UserId userId) async {
  try {
    final albumModels = await _dataSource.getUserAlbums(
      userId: userId.value,
    );
    final albums = albumModels.map<Album>(AlbumFromModel()).toList();
    return Result(albums);
  } catch (e, s) {
    _logger.e('Getting albums for user ${userId.value} has failed!', e, s);
    return Result.failure(Failure(e, s));
  }
}