screenshot_desktop 1.0.0
screenshot_desktop: ^1.0.0 copied to clipboard
A pure Dart package for capturing high-resolution desktop screenshots on macOS and Windows, with multi-monitor support.
screenshot_desktop #
A Dart package for taking desktop screenshots on macOS and Windows.
Unlike many other screenshot packages, this one does not depend on Flutter. It can be used in command-line tools or any other pure Dart environment, while remaining fully compatible with Flutter applications.
Features #
- Multi-monitor support: List all available monitors and their resolutions.
- Specific monitor capture: Take a high-resolution screenshot of a specific monitor.
- Pure Dart: No Flutter dependency required.
Getting started #
Add screenshot_desktop to your pubspec.yaml:
dependencies:
screenshot_desktop: ^1.0.0
Usage #
import 'package:screenshot_desktop/screenshot_desktop.dart';
import 'dart:io';
void main() async {
// 1. Get available monitors
final monitors = await ScreenshotDesktop.instance.getAvailableMonitors();
for (final monitor in monitors) {
print('Monitor: ${monitor.name} (${monitor.width}x${monitor.height})');
}
if (monitors.isNotEmpty) {
// 2. Capture a specific monitor
final screenshot = await ScreenshotDesktop.instance.takeScreenshot(monitors.first);
// 3. Save as a file (Windows: BMP, macOS: PNG)
final extension = Platform.isWindows ? 'bmp' : 'png';
await File('screenshot.$extension').writeAsBytes(screenshot);
}
}
Additional information #
For more information, issues, or contributions, please visit the repository.