screen_capture_kit 0.0.2
screen_capture_kit: ^0.0.2 copied to clipboard
Native Dart bindings for macOS ScreenCaptureKit using Dart Build Hooks.
ScreenCaptureKit for Dart #
Native Dart bindings for macOS ScreenCaptureKit using Dart Build Hooks.
screen_capture_kit provides high-performance access to Apple's ScreenCaptureKit API from Dart applications.
It enables screen, window, and display capture on macOS with minimal overhead by calling the native APIs directly.
Features #
- Display capture — Capture entire displays or regions
- Window capture — Capture individual windows
- Region capture — Crop to a specific area via
sourceRect - Screenshot — Single-frame capture (macOS 14+)
- System picker — Native content-sharing picker UI (macOS 14+)
- Audio capture — System audio (macOS 13+), optional microphone (macOS 15+)
- Cursor capture — Include or hide the system cursor
- Frame rate configuration — 1–120 fps
- Multi-display — Capture any connected display
- Powered by Dart Build Hooks — No Flutter dependency (pure Dart support)
Platform Support #
| Platform | Support |
|---|---|
| macOS | ✅ |
| Windows | ❌ |
| Linux | ❌ |
| iOS | ❌ |
| Android | ❌ |
macOS 12.3 or later is required. Screenshot and system picker require macOS 14+.
Audio capture requires macOS 13+; microphone capture requires macOS 15+.
Installation #
Add the package:
dart pub add screen_capture_kit
Example #
import 'package:screen_capture_kit/screen_capture_kit.dart';
void main() async {
final kit = ScreenCaptureKit();
final content = await kit.getShareableContent();
if (content.displays.isEmpty) return;
final display = content.displays.first;
final filter = await kit.createDisplayFilter(display);
kit.startCaptureStream(filter, width: display.width, height: display.height)
.listen((frame) {
print('Frame: ${frame.width}x${frame.height}');
});
// Call kit.releaseFilter(filter) when done
}
Usage flow #
- Get shareable content —
getShareableContent()returns displays, windows, and applications. - Create a content filter —
createDisplayFilter()orcreateWindowFilter()for the target. - Start capture —
startCaptureStream()for frames, orstartCaptureStreamWithUpdater()for runtime config changes and audio. - Release — Call
releaseFilter()when done.
For screenshots, use captureScreenshot(filterHandle). For the system picker, use presentContentSharingPicker().
Architecture #
This package uses Dart Build Hooks to compile native macOS code and bridge the ScreenCaptureKit APIs to Dart.
Dart
│
│ Dart API
▼
Native Bridge (Objective-C)
│
│ FFI / Dart Build Hooks
▼
ScreenCaptureKit
This design allows low-latency frame capture while keeping the Dart API simple.
Example app #
See the example/ directory for a full sample including display, window, region, and system picker capture.