File tree 1 file changed +29
-0
lines changed
1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 1
1
import 'dart:ffi' ;
2
+ import 'package:ffi/ffi.dart' ;
2
3
import 'package:flatpak/src/libflatpak.dart' ;
3
4
4
5
class Flatpak {
@@ -15,9 +16,37 @@ class Flatpak {
15
16
int micro = FLATPAK_MICRO_VERSION ;
16
17
return '$major .$minor .$micro ' ;
17
18
}
19
+
20
+ int getInstances () {
21
+ Pointer <GPtrArray > instances = libFlatpak.flatpak_instance_get_all ();
22
+ return instances.ref.len;
23
+ }
24
+
25
+ List <String > getSupportedArches () {
26
+ Pointer <Pointer <Char >> supportedArches =
27
+ libFlatpak.flatpak_get_supported_arches ();
28
+
29
+ List <String > supportedArchesList = [];
30
+ int index = 0 ;
31
+
32
+ while (true ) {
33
+ Pointer <Char > archPtr = supportedArches.elementAt (index).value;
34
+ if (archPtr == nullptr) {
35
+ break ;
36
+ }
37
+ String arch = archPtr.cast <Utf8 >().toDartString ();
38
+ supportedArchesList.add (arch);
39
+ index++ ;
40
+ }
41
+
42
+ malloc.free (supportedArches);
43
+
44
+ return supportedArchesList;
45
+ }
18
46
}
19
47
20
48
void main () {
21
49
Flatpak flatpak = Flatpak ();
22
50
print ("Flatpak version: ${flatpak .version ()}" );
51
+ print ("Supported arches: ${flatpak .getSupportedArches ()}" );
23
52
}
You can’t perform that action at this time.
0 commit comments