Viewing version 3.0.3. Open the latest package page.
win32_registry
3.0.3A modern, type-safe Dart API for accessing and managing the Windows Registry.
Readme
ci codecov Package: win32_registry Publisher: halildurmus.dev Language: Dart License: BSD-3-Clause
A modern, type-safe Dart API for accessing and managing the Windows Registry.
This package builds on top of the package:win32 and provides a high-level abstraction over native registry APIs. It eliminates the need to work directly with FFI, raw pointers, or low-level Win32 calls while preserving performance and correctness.
✨ Features
- Key Management — Create, open, delete, and rename registry keys.
- Typed Values — Read and write strings, integers, binary data, and multi-string values using strongly typed APIs.
- Change Monitoring — Listen for registry modifications.
- Metadata Queries — Inspect subkeys, values, sizes, and timestamps.
- Transaction Support — Perform registry operations atomically.
🚀 Getting Started
Add the package to your pubspec.yaml:
dependencies:
win32_registry: ^3.0.0
Then import it:
import 'package:win32_registry/win32_registry.dart';
⚡ Quick Example
Reads the Windows build number from the registry:
void main() {
final key = LOCAL_MACHINE.open(
r'Software\Microsoft\Windows NT\CurrentVersion',
);
final buildNumber = key.getString('CurrentBuild');
if (buildNumber != null) {
print('Windows build number: $buildNumber');
}
key.close();
}
📝 Documentation
Full API reference is available here:
Additional usage examples are located in the example directory.
🐞 Features and Bugs
If you encounter bugs or need additional functionality, please file an issue.
Changelog
Changelog
All notable changes to this project will be documented in this file.
3.0.3 - 2026-04-11
📦 Dependencies
- Lower minimum Dart SDK to 3.10
3.0.2 - 2026-02-27
🏠 Repository
- Package has been moved to the
halildurmus/win32monorepo.
3.0.1 - 2026-02-26
📦 Dependencies
- Allow
package:metaversions from1.17.0up to but not including2.0.0to ensure compatibility with a wider range of Dart SDK versions.
3.0.0 - 2026-02-22
🔄 Breaking Changes
This release introduces a major overhaul of the API with improved type safety, and powerful new capabilities.
The package now offers transaction support, enhanced monitoring, and a more intuitive interface for managing registry keys and values.
Key breaking changes include:
-
API Restructuring:
- Removed
Registryclass entirely. Static methods likeRegistry.openPath()are no longer available. - Removed
RegistryHiveenum. Use predefined top-level fields instead:RegistryHive.localMachine→LOCAL_MACHINERegistryHive.currentUser→CURRENT_USERRegistryHive.classesRoot→CLASSES_ROOTRegistryHive.allUsers→USERSRegistryHive.performanceData→PERFORMANCE_DATARegistryHive.currentConfig→CURRENT_CONFIG
- Removed
-
AccessRights→RegistryAccess:- Replaced enum with a final class offering bitwise combination support.
- Renamed constants:
readOnly→readwriteOnly→writeallAccess→all
- Added new access rights:
notify,readWrite - Supports combining access rights with the
|operator.
-
RegistryKey:- Opening and creating keys now requires calling methods on predefined
constants or existing keys:
- Old:
Registry.openPath(RegistryHive.localMachine, path: keyPath) - New:
LOCAL_MACHINE.open(keyPath)
- Old:
- Renamed methods:
getBinaryValue()→getBinary()getIntValue()→getInt()getStringValue()→getString()getStringArrayValue()→getMultiString()createKey()→create()deleteKey()→removeSubkey()deleteValue()→removeValue()renameSubkey()→rename()
create()andopen()now accept aRegistryOpenConfigparameter for fine-grained control of access rights, options, and transactions.onChanged()stream functionality replaced withRegistryChangeMonitorclass.
- Opening and creating keys now requires calling methods on predefined
constants or existing keys:
-
RegistryValue:- Constructors no longer accept a
nameparameter. Value names are now passed directly tosetValue():- Old:
RegistryValue.string('MyValue', 'data') - New:
key.setValue('MyValue', RegistryValue.string('data'))or with dot shorthand syntax:key.setValue('MyValue', const .string('data'))
- Old:
- Renamed factory constructors:
int32()→dword()int64()→qword()stringArray()→multiString()
- Constructors no longer accept a
-
RegistryValueType:- Changed from enum to final class with a factory constructor.
- Renamed constants:
int32→dwordint64→qwordstringArray→multiString
- Renamed field:
value→raw - Replaced
fromWin32()factory withfromRaw().
🚀 Features
-
Transaction Support:
- New
Transactionclass enables atomic registry operations. - Pass a
Transactioninstance viaRegistryOpenConfigto perform multiple operations that can be committed or rolled back as a unit.
- New
-
Enhanced Registry Monitoring:
- New
RegistryChangeMonitorclass provides isolate-backed, stream-based monitoring of registry key changes. - Replaces the previous
onChanged()stream approach with more robust error handling and resource management.
- New
-
Configuration Objects:
RegistryOpenConfig: Centralizes parameters for opening and creating keys (access rights, creation behavior, options, transactions).RegistryOpenOptions: Type-safe wrapper for native registry options (nonVolatile,volatile,createLink,backupRestore, etc.).
-
New Key Management Methods:
removeTree(): Recursively deletes all subkeys and values within a key without deleting the key itself.removeValues(): Deletes all values under a key without affecting subkeys.
📦 Dependencies
- Bumped minimum required Dart SDK version to
3.11.0.
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.
Installing
export PUB_HOSTED_URL=https://pub.mirror.p-hatan.com
flutter pub add 'win32_registry:3.0.3'pubspec.yaml
name: win32_registry
description: >
A modern, type-safe Dart API for accessing and managing the Windows Registry.
version: 3.0.3
repository: https://github.com/halildurmus/win32/tree/main/packages/win32_registry
issue_tracker: https://github.com/halildurmus/win32/issues?q=is%3Aissue%20state%3Aopen%20label%3A%22package%3A%20win32_registry%22
funding:
- https://github.com/sponsors/halildurmus
topics:
- registry
- win32
- ffi
- windows
environment:
sdk: ^3.10.0
platforms:
windows:
resolution: workspace
dependencies:
collection: ^1.19.1
ffi: ^2.1.4
ffi_leak_tracker: ^0.1.1
meta: ^1.17.0
win32: ^6.0.0
dev_dependencies:
checks: ^0.3.1
halildurmus_hooks: ^0.1.0
halildurmus_lints: ^1.1.0
test: ^1.27.0
Version history
| Version | Published | Archive | SHA-256 |
|---|---|---|---|
| 0.1.0 | On demand | Download | 1e702d72…8a75d5 |
| 0.1.1 | On demand | Download | 23ad9d83…95b058 |
| 0.1.2 | On demand | Download | 36e7bc51…3715f6 |
| 1.0.0 | On demand | Download | 6b28a272…d9a229 |
| 1.0.1 | On demand | Download | fd15f77f…9cadbe |
| 1.0.2 | On demand | Download | 66e78552…4520e3 |
| 1.1.0 | On demand | Download | 1c52f994…b0bfae |
| 1.1.1 | On demand | Download | e4506d60…5be4c9 |
| 1.1.2 | On demand | Download | 41fd8a18…39d85a |
| 1.1.3 | On demand | Download | 10589e0d…a2a9bb |
| 1.1.4 | On demand | Download | 723b7f85…cda0d6 |
| 1.1.5 | On demand | Download | 21ec76df…a99852 |
| 2.0.0 | On demand | Download | 12038454…94c249 |
| 2.0.1 | On demand | Download | 0076530f…a05798 |
| 2.1.0 | On demand | Download | 6f1b5644…618dae |
| 3.0.0 | On demand | Download | 8c862347…d3c549 |
| 3.0.1 | On demand | Download | c49d93ef…5aa177 |
| 3.0.2 | On demand | Download | 345b4015…50ef77 |
| 3.0.3 | Cached · Upstream SHA-256 matched | Download | 73b1d789…116904 |
Dependencies
collection "^1.19.1"
ffi "^2.1.4"
ffi_leak_tracker "^0.1.1"
meta "^1.17.0"
win32 "^6.0.0"