Skip to content

Commit a6b5a79

Browse files
Merge #290
290: Update searchable.dart r=brunoocasali a=ahmednfwela rename the extension methods to align with the searchable methods cc `@brunoocasali` Co-authored-by: Ahmed Fwela <[email protected]> Co-authored-by: Ahmed Fwela <[email protected]>
2 parents ce5d565 + 791a97b commit a6b5a79

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/src/searchable.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,21 @@ extension SearchableExt<T> on Future<Searcheable<T>> {
6262
Future<SearchResult<T>> asSearchResult() =>
6363
then((value) => value.asSearchResult());
6464

65-
Future<Searcheable<TOther>> cast<TOther>(
65+
Future<Searcheable<TOther>> map<TOther>(
6666
MeilisearchDocumentMapper<T, TOther> mapper,
6767
) =>
6868
then((value) => value.map(mapper));
6969
}
7070

7171
extension SearchResultExt<T> on Future<SearchResult<T>> {
72-
Future<SearchResult<TOther>> cast<TOther>(
72+
Future<SearchResult<TOther>> map<TOther>(
7373
MeilisearchDocumentMapper<T, TOther> mapper,
7474
) =>
7575
then((value) => value.map(mapper));
7676
}
7777

7878
extension PaginatedSearchResultExt<T> on Future<PaginatedSearchResult<T>> {
79-
Future<PaginatedSearchResult<TOther>> cast<TOther>(
79+
Future<PaginatedSearchResult<TOther>> map<TOther>(
8080
MeilisearchDocumentMapper<T, TOther> mapper,
8181
) =>
8282
then((value) => value.map(mapper));

test/search_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ void main() {
1616
//search
1717
//if deserialization fails it will throw
1818
final castedResult =
19-
await index.search('').asSearchResult().cast(BookDto.fromMap);
19+
await index.search('').asSearchResult().map(BookDto.fromMap);
2020
//test
2121
expect(castedResult.hits, everyElement(isA<BookDto>()));
2222
});

0 commit comments

Comments
 (0)