Skip to content

Commit c5a0427

Browse files
authored
Update plugin to use win32_registry version 2.0.0 (#33)
* Update pubspec.yaml with new version of win32_registry * Update app_auto_launcher_impl_windows.dart to use new win32_registry APIs
1 parent 32e0fb6 commit c5a0427

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

lib/src/app_auto_launcher_impl_windows.dart

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,8 @@ class AppAutoLauncherImplWindows extends AppAutoLauncher {
4848
@override
4949
Future<bool> enable() async {
5050
_regKey.createValue(
51-
RegistryValue(
51+
RegistryValue.string(
5252
appName,
53-
RegistryValueType.string,
5453
_registryValue,
5554
),
5655
);
@@ -60,7 +59,7 @@ class AppAutoLauncherImplWindows extends AppAutoLauncher {
6059
bytes[0] = 2;
6160

6261
_startupApprovedRegKey
63-
.createValue(RegistryValue(appName, RegistryValueType.binary, bytes));
62+
.createValue(RegistryValue.binary(appName, bytes));
6463

6564
return true;
6665
}
@@ -76,15 +75,13 @@ class AppAutoLauncherImplWindows extends AppAutoLauncher {
7675
// Odd first byte will prevent the app from autostarting
7776
// Empty or any other value will allow the app to autostart
7877
Future<bool> _isStartupApproved() async {
79-
final value = _startupApprovedRegKey.getValue(appName);
78+
final data = _startupApprovedRegKey.getBinaryValue(appName);
8079

81-
if (value == null) {
80+
if (data == null) {
8281
return true;
8382
}
8483

85-
final data = value.data;
86-
87-
if (data is! Uint8List || data.isEmpty) {
84+
if (data.isEmpty) {
8885
return true;
8986
}
9087

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ environment:
1515
dependencies:
1616
flutter:
1717
sdk: flutter
18-
win32_registry: ^1.1.3
18+
win32_registry: ^2.0.0
1919

2020
dev_dependencies:
2121
dependency_validator: ^3.0.0
2222
flutter_test:
2323
sdk: flutter
24-
mostly_reasonable_lints: ^0.1.2
24+
mostly_reasonable_lints: ^0.1.2

0 commit comments

Comments
 (0)