win32_registry
v2.1.0A package that provides a friendly Dart API for accessing the Windows Registry.
Package archive: https://pubdev.letsnova.ru/api/archives/win32_registry/2.1.0.tar.gz
dart pub add win32_registryReadme
A package that provides a friendly Dart API for accessing the Windows Registry.
This package builds on top of the Dart win32 package, offering a high-level Dart wrapper that avoids the need for users to understand FFI or write directly to the Win32 API.
Features
- Manage Registry Keys: Create, open, delete, and rename registry keys.
- Set and Get Values: Store and retrieve strings, integers, binary data, and string arrays.
- Monitor Changes: Listen for changes in registry keys.
- Query Key Details: Get information about subkeys and values within a registry key.
To learn more, see the API Documentation.
Usage
A simple example that reads the Windows build number from the Windows Registry:
import 'package:win32_registry/win32_registry.dart';
void main() {
const keyPath = r'Software\Microsoft\Windows NT\CurrentVersion';
final key = Registry.openPath(RegistryHive.localMachine, path: keyPath);
final buildNumber = key.getStringValue('CurrentBuild');
if (buildNumber != null) print('Windows build number: $buildNumber');
key.close();
}
More examples can be found in the example subdirectory.
Feature requests and bugs
Please file feature requests and bugs at the issue tracker.
Changelog
Changelog
All notable changes to this project will be documented in this file.
2.1.0 - 2025-02-19
📦 Dependencies
- Bump
win32from 5.8.0 to 5.11.0 by @halildurmus in #30
🎨 Styling
- Format with tall-style by @halildurmus in #29
2.0.1 - 2024-12-10
🐛 Bug Fixes
2.0.0 - 2024-11-02
This release introduces significant changes to the API with a streamlined structure, new methods for specific registry data handling, and enhanced support for monitoring registry key changes.
🔄 Breaking Changes
-
AccessRights:win32Valuefield renamed tovalue.
-
Registry:- Now an
abstract finalclass. - Removed
performanceDatastatic getter.
- Now an
-
RegistryHive:- Constructor is now private.
win32Valuefield renamed tovalue.
-
RegistryKey:- Now a
finalclass.
- Now a
-
RegistryValue:- Now a
sealedclass. - Removed
fromWin32factory constructor. - Removed
toWin32getter. - Removed
datafield.
- Now a
-
RegistryValueType:- Constructor is now private.
win32Valuefield renamed tovalue.- Removed
unknownvalue. - Removed
win32Typegetter.
✨ New Features
-
Registry Hive Construction:
- Added
RegistryHive.fromWin32factory constructor for creating hives based on Win32 constants.
- Added
-
Enhanced Data Retrieval:
- Added type-specific methods to
RegistryKey:getBinaryValue,getIntValue,getStringValue, andgetStringArrayValuefor retrieving data in specific formats. - Deprecated
getValueAsIntandgetValueAsStringmethods in favor of the new type-specific methods.
- Added type-specific methods to
-
Registry Change Notifications:
- Introduced
RegistryKey.onChangedstream for monitoring registry key changes, with optional subkey tracking.
- Introduced
-
Typed Registry Values:
- Introduced specialized subclasses in
RegistryValuefor each registry value type, enhancing clarity and simplifying data handling.
- Introduced specialized subclasses in
-
Registry Value Type Construction:
- Added
RegistryValueType.fromWin32factory constructor to handle value type creation based on Win32 constants.
- Added
🚨 Dart SDK Requirement
- Bumped the minimum required Dart SDK version to
3.5.0.
1.1.5
- Fix issue where creating
REG_SZorREG_EXPANDED_SZstring registry values resulted in malformed data. The null terminator for string values was incorrectly encoded as a single byte instead of the required two bytes for UTF-16 encoding (#22, thanks to @dancarrollg).
1.1.4
- Fix issue where
RegistryValue.datafor binary-type registry values might be freed before being read (#19, thanks @tylerlacey). - Bump minimum required Dart SDK version to
3.4.0
1.1.3
- Fix deprecation warnings
- Update links
- Bump minimum required Dart SDK version to
3.3.0
1.1.2
- Improved code quality.
- Improved documentation.
1.1.1
- Update dependency constraints.
1.1.0
- Add
recursivenamed option to methoddeleteKey()ofRegistryKey(thanks @Zekfad) - Use enhanced enums from Dart 2.17.
- Update dependency constraints.
1.0.2
- Update
ffidependency constraints to>=1.1.2 <3.0.0.
1.0.1
- Minor tweaks to documentation.
1.0.0
- First stable release.
