getAllAlbums method Null safety

  1. @override
Future<Result<List<Album>>> getAllAlbums()
override

Returns result with all available photo albums.

Implementation

@override
Future<Result<List<Album>>> getAllAlbums() async {
  try {
    final albumModels = await _dataSource.getAllAlbums();
    final albums = albumModels.map<Album>(AlbumFromModel()).toList();
    return Result(albums);
  } catch (e, s) {
    _logger.e('Getting all albums has failed!', e, s);
    return Result.failure(Failure(e, s));
  }
}