Skip to content

Commit

Permalink
perf: recent orders are now parsed in a seperate isolate
Browse files Browse the repository at this point in the history
  • Loading branch information
SlayerOrnstein committed Jan 25, 2024
1 parent c7016a1 commit b08a1f7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/src/endpoints/orders.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:compute/compute.dart';
import 'package:market_client/market_client.dart';

/// {@template orders_endpoint}
Expand Down Expand Up @@ -33,7 +34,7 @@ class OrdersEndpoint {
/// Not sure up till when so expect a long list.
Future<MostRecentOrders> fetchRecentOrders() async {
final response = await _client.get('/most_recent');
final data = HttpHelpers.parseResponse(response.body);
final data = await compute(HttpHelpers.parseResponse, response.body);
final payload = data['payload'] as Map<String, dynamic>;

return MostRecentOrders.fromJson(payload);
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ environment:
sdk: ">=3.2.0 <4.0.0"

dependencies:
compute: ^1.0.2
equatable: ">=2.0.5 <3.0.0"
http: ">=1.0.0 <2.0.0"
json_annotation: ">=4.8.1 <5.0.0"
Expand Down

0 comments on commit b08a1f7

Please sign in to comment.