Capture screenshots in Dart
Add screenshot and scrolling GIF capabilities to your Dart and Flutter applications with the http package. Cross-platform, no headless browsers to manage.
Installation
- 1Add http package: dart pub add http (or flutter pub add http)
- 2Get your API key from the dashboard
- 3Set the X-KEY header in your requests
Authentication
Include your API key in the X-KEY header with every request:
import 'package:http/http.dart' as http;
final response = await http.get(
Uri.parse(url),
headers: {'X-KEY': 'your-api-key'},
);Dart Screenshot Example
Capture a screenshot or create a scrolling GIF animation with a simple GET request:
import 'dart:io';
import 'package:http/http.dart' as http;
void main() async {
final response = await http.get(
Uri.parse('https://api.scrnpix.com/screenshot?url=https%3A%2F%2Fexample.com&width=1280&height=720&format=png'),
headers: {'X-KEY': 'your-api-key'},
);
await File('screenshot.png').writeAsBytes(response.bodyBytes);
}import 'dart:io';
import 'package:http/http.dart' as http;
void main() async {
final response = await http.get(
Uri.parse('https://api.scrnpix.com/animate?url=https%3A%2F%2Fexample.com&scroll_duration=3000&scroll_easing=ease-in-out'),
headers: {'X-KEY': 'your-api-key'},
);
await File('animation.gif').writeAsBytes(response.bodyBytes);
}Response Format
On success, the API returns the image binary data directly in the response body.
| Status Code | 200 OK |
| Content-Type | image/png, image/jpeg, or image/gif |
| Body | Binary image data (Uint8List) |
| Error Response | Error message with 4xx/5xx status |
Key Features
Zero Setup
No need to manage WebView or browser instances. Just use the http package for simple HTTP calls.
Production Ready
Built on Cloudflare Workers with global edge network. Handles concurrency and browser lifecycle automatically.
Dart Integration
Native async/await support. Works with Flutter mobile, web, desktop, or server-side Dart applications.
Rich Features
Custom viewport sizes, full page capture, PNG/JPEG formats, scrolling GIFs with 15 easing functions.
Frequently Asked Questions
Do I need to install any browser dependencies for Dart?
No. Scrnpix runs browsers on our infrastructure. You only need the http package to make HTTP calls.
Can I use this with Flutter?
Yes. Scrnpix works with any Dart environment — Flutter mobile, web, desktop, or server-side Dart applications.
How do I handle errors in Dart?
Check the response.statusCode. A 200 status means success with image bytes in bodyBytes. Use try-catch for error handling.
What Dart version is required?
Dart 2.17+ or Dart 3 with null safety. The API is a simple HTTP GET request.
Ready to capture screenshots in Dart?
Get your API key and start rendering screenshots in seconds. Free tier includes 50 screenshots per month.
Start Free