File tree Expand file tree Collapse file tree 2 files changed +3
-20
lines changed Expand file tree Collapse file tree 2 files changed +3
-20
lines changed Original file line number Diff line number Diff line change @@ -11,28 +11,10 @@ void main() async {
1111 Uri.parse('https://dashboard.algolia.com/sample_datasets/movie.json'));
1212
1313 if (datasetRequest.statusCode == 200) {
14- final moviesData = jsonDecode(datasetRequest.body);
15-
16- final batchRequests = < BatchRequest> [];
17-
18- for (final movie in moviesData) {
19- batchRequests.add(
20- BatchRequest(action: Action.fromJson(' addObject' ), body: movie),
21- );
22- }
14+ final movies = jsonDecode(datasetRequest.body);
2315
16+ // push data to algolia
2417 {{#dynamicSnippet} }saveObjectsMovies{ {/dynamicSnippet} }
25-
26- try {
27- // push data to algolia
28- await client.batch(
29- indexName: ' movies_index' ,
30- batchWriteParams: BatchWriteParams(requests: batchRequests),
31- );
32- print(" Successfully indexed records!" );
33- } catch (e) {
34- print(" Error: ${e.toString()}" );
35- }
3618 } else {
3719 throw Exception(' Failed to load data' );
3820 }
Original file line number Diff line number Diff line change 1212 expect(res, { {#match} }{ {> tests/param_value} }{ {/match} });
1313 { {/match.isPrimitive} }
1414 { {/testResponse} }
15+ print('successfully indexed records!');
1516} on InterceptionException catch (_) {
1617 // Ignore InterceptionException
1718}
You can’t perform that action at this time.
0 commit comments