@@ -16,6 +16,9 @@ final class SecureStoragePlatformLinux extends SecureStoragePlatform {
16
16
final _glibDylib = DynamicLibrary .open ('libglib-2.0.so.0' );
17
17
late final _glib = Glib (_glibDylib);
18
18
19
+ final _gioDylib = DynamicLibrary .open ('libgio-2.0.so' );
20
+ late final _gio = Glib (_gioDylib);
21
+
19
22
final _libSecretDylib = DynamicLibrary .open ('libsecret-1.so.0' );
20
23
late final _libSecret = Libsecret (_libSecretDylib);
21
24
@@ -24,11 +27,11 @@ final class SecureStoragePlatformLinux extends SecureStoragePlatform {
24
27
'g_str_hash' );
25
28
26
29
late final String _appName = () {
27
- final application = _glib .g_application_get_default ();
30
+ final application = _gio .g_application_get_default ();
28
31
if (application == nullptr) {
29
32
return File ('/proc/self/exe' ).resolveSymbolicLinksSync ();
30
33
}
31
- return _glib
34
+ return _gio
32
35
.g_application_get_application_id (application)
33
36
.cast <Utf8 >()
34
37
.toDartString ();
@@ -43,23 +46,25 @@ final class SecureStoragePlatformLinux extends SecureStoragePlatform {
43
46
SecretSchemaAttributeType .SECRET_SCHEMA_ATTRIBUTE_STRING ;
44
47
45
48
Pointer <GHashTable > _attributes ({
46
- required String key,
49
+ String ? key,
47
50
required Arena arena,
48
51
}) {
49
52
final hashTable = _glib.g_hash_table_new (_gStrHashPointer, nullptr);
50
- _glib.g_hash_table_insert (
51
- hashTable,
52
- 'key' .toNativeUtf8 (allocator: arena).cast (),
53
- key.toNativeUtf8 (allocator: arena).cast (),
54
- );
53
+ if (key != null ) {
54
+ _glib.g_hash_table_insert (
55
+ hashTable,
56
+ 'key' .toNativeUtf8 (allocator: arena).cast (),
57
+ key.toNativeUtf8 (allocator: arena).cast (),
58
+ );
59
+ }
55
60
arena.onReleaseAll (() => _glib.g_hash_table_destroy (hashTable));
56
61
return hashTable;
57
62
}
58
63
59
64
@override
60
65
void clear () => using ((arena) {
61
66
final schema = _schemaFor (arena);
62
- final attributes = _attributes (key : '' , arena: arena);
67
+ final attributes = _attributes (arena: arena);
63
68
_libSecret.secret_password_clearv_sync (
64
69
schema,
65
70
attributes,
0 commit comments