# {frontmatter.title}
```dart
In this chapter, we will learn how to use the hotkey_manager package to implement global hotkey functionality.
## Register Hotkey
```dart
class HotKeySettingsPage extends StatefulWidget {
@override
_HotKeySettingsPageState createState() => _HotKeySettingsPageState();
}
class _HotKeySettingsPageState extends State<HotKeySettingsPage> {
HotKey? _currentHotKey;
bool _isRecording = false;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Hotkey Settings'),
),
body: Padding(
padding: EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Current Hotkey: ${_currentHotKey?.toJson() ?? "Not Set"}',
style: Theme.of(context).textTheme.titleMedium,
),
SizedBox(height: 20),
ElevatedButton(
onPressed: () {
setState(() {
_isRecording = true;
});
},
child: Text('Set New Hotkey'),
),
if (_isRecording)
KeyboardListener(
focusNode: FocusNode(),
onKeyEvent: (event) {
// Handle key events
},
child: Container(),
),
],
),
),
);
}
}
## Common Issues
1. **Why doesn't the hotkey work?**
- Check system permissions
- Verify hotkey conflicts
2. **How to save settings?**
- Use shared_preferences
## Next Steps
Learn about state management in the next chapter.