Skip to content

Commit 2a24dd6

Browse files
authored
chore(device_info_plus): bump win32_registry from 1.1.5 to 2.0.1 in /packages/device_info_plus/device_info_plus (#3486)
1 parent fdac82b commit 2a24dd6

File tree

2 files changed

+17
-21
lines changed

2 files changed

+17
-21
lines changed

packages/device_info_plus/device_info_plus/lib/src/device_info_plus_windows.dart

+16-20
Original file line numberDiff line numberDiff line change
@@ -50,28 +50,25 @@ class DeviceInfoPlusWindowsPlugin extends DeviceInfoPlatform {
5050
try {
5151
final currentVersionKey = Registry.openPath(RegistryHive.localMachine,
5252
path: r'SOFTWARE\Microsoft\Windows NT\CurrentVersion');
53-
final buildLab = currentVersionKey.getValueAsString('BuildLab') ?? '';
54-
final buildLabEx = currentVersionKey.getValueAsString('BuildLabEx') ?? '';
55-
final digitalProductIdValue =
56-
currentVersionKey.getValue('DigitalProductId');
57-
final digitalProductId = digitalProductIdValue != null &&
58-
digitalProductIdValue.data is Uint8List
59-
? digitalProductIdValue.data as Uint8List
60-
: Uint8List.fromList([]);
53+
final buildLab = currentVersionKey.getStringValue('BuildLab') ?? '';
54+
final buildLabEx = currentVersionKey.getStringValue('BuildLabEx') ?? '';
55+
final digitalProductId =
56+
currentVersionKey.getBinaryValue('DigitalProductId') ??
57+
Uint8List.fromList([]);
6158
final displayVersion =
62-
currentVersionKey.getValueAsString('DisplayVersion') ?? '';
63-
final editionId = currentVersionKey.getValueAsString('EditionID') ?? '';
59+
currentVersionKey.getStringValue('DisplayVersion') ?? '';
60+
final editionId = currentVersionKey.getStringValue('EditionID') ?? '';
6461
final installDate = DateTime.fromMillisecondsSinceEpoch(
65-
1000 * (currentVersionKey.getValueAsInt('InstallDate') ?? 0));
66-
final productId = currentVersionKey.getValueAsString('ProductID') ?? '';
67-
var productName = currentVersionKey.getValueAsString('ProductName') ?? '';
62+
1000 * (currentVersionKey.getIntValue('InstallDate') ?? 0));
63+
final productId = currentVersionKey.getStringValue('ProductID') ?? '';
64+
var productName = currentVersionKey.getStringValue('ProductName') ?? '';
6865
final registeredOwner =
69-
currentVersionKey.getValueAsString('RegisteredOwner') ?? '';
70-
final releaseId = currentVersionKey.getValueAsString('ReleaseId') ?? '';
66+
currentVersionKey.getStringValue('RegisteredOwner') ?? '';
67+
final releaseId = currentVersionKey.getStringValue('ReleaseId') ?? '';
7168

7269
final sqmClientKey = Registry.openPath(RegistryHive.localMachine,
7370
path: r'SOFTWARE\Microsoft\SQMClient');
74-
final machineId = sqmClientKey.getValueAsString('MachineId') ?? '';
71+
final machineId = sqmClientKey.getStringValue('MachineId') ?? '';
7572

7673
GetSystemInfo(systemInfo);
7774

@@ -138,14 +135,13 @@ class DeviceInfoPlusWindowsPlugin extends DeviceInfoPlatform {
138135
// We call this a first time to get the length of the string in characters,
139136
// so we can allocate sufficient memory.
140137
final nSize = calloc<DWORD>();
141-
GetComputerNameEx(
142-
COMPUTER_NAME_FORMAT.ComputerNameDnsFullyQualified, nullptr, nSize);
138+
GetComputerNameEx(ComputerNameDnsFullyQualified, nullptr, nSize);
143139

144140
// Now allocate memory for a native string and call this a second time.
145141
final lpBuffer = wsalloc(nSize.value);
146142
try {
147-
final result = GetComputerNameEx(
148-
COMPUTER_NAME_FORMAT.ComputerNameDnsFullyQualified, lpBuffer, nSize);
143+
final result =
144+
GetComputerNameEx(ComputerNameDnsFullyQualified, lpBuffer, nSize);
149145

150146
if (result != 0) {
151147
return lpBuffer.toDartString();

packages/device_info_plus/device_info_plus/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ dependencies:
3939
meta: ^1.8.0
4040
web: ^1.0.0
4141
win32: ^5.5.3
42-
win32_registry: ^1.1.0
42+
win32_registry: ^2.0.1
4343

4444
dev_dependencies:
4545
flutter_lints: ">=4.0.0 <6.0.0"

0 commit comments

Comments
 (0)