Skip to content

Commit 707b661

Browse files
committed
fix cli compilation after
caused by ms store refactor
1 parent 12b6ad1 commit 707b661

File tree

4 files changed

+17
-7
lines changed

4 files changed

+17
-7
lines changed

src/lib/core/compute.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import 'dart:async';
2+
import 'dart:isolate';
3+
4+
typedef ComputeCallback<M, R> = FutureOr<R> Function(M message);
5+
6+
/// Runs [callback] in a background isolate and returns its result.
7+
/// Flutter's built-in `compute` function cannot be used in CLI version.
8+
Future<R> compute<M, R>(ComputeCallback<M, R> callback, M message) {
9+
return Isolate.run(() => callback(message));
10+
}

src/lib/features/ms_store/ms_store_enums.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import 'package:fluent_ui/fluent_ui.dart';
2-
31
enum MSStoreAppType {
42
uwp(prefix: '9', installCommand: 'Add-AppxPackage'),
53
win32(prefix: 'XP');
@@ -26,9 +24,6 @@ enum MSStoreRing {
2624
const MSStoreRing({required this.value, required this.label});
2725
final String value;
2826
final String label;
29-
30-
static List<ComboBoxItem<MSStoreRing>> get items =>
31-
values.map((e) => ComboBoxItem(value: e, child: Text(e.label))).toList();
3227
}
3328

3429
/// CPU architecture for package filtering

src/lib/features/ms_store/ms_store_page.dart

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,12 @@ class _MSStorePageState extends ConsumerState<MSStorePage> {
7575
ComboBox<MSStoreRing>(
7676
value: _selectedRing,
7777
onChanged: (value) => setState(() => _selectedRing = value!),
78-
items: MSStoreRing.items,
78+
items: MSStoreRing.values
79+
.map(
80+
(ring) =>
81+
ComboBoxItem(value: ring, child: Text(ring.label)),
82+
)
83+
.toList(),
7984
),
8085
],
8186
),

src/lib/features/ms_store/ms_store_repository.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import 'dart:io';
22

33
import 'package:dio/dio.dart';
4-
import 'package:flutter/foundation.dart';
54

5+
import '../../core/compute.dart';
66
import 'models/package_info.dart';
77
import 'models/product_details/product_details.dart';
88
import 'models/search/search_product.dart';

0 commit comments

Comments
 (0)