xcelerate 1.0.10 copy "xcelerate: ^1.0.10" to clipboard
xcelerate: ^1.0.10 copied to clipboard

Chrome DevTools Protocol client for Dart/Flutter, backed by the xcelerate Rust core.

Xcelerate Dart / Flutter SDK #

Note: the early uniffi-bindgen-dart 0.1.x generator has several codegen bugs for this API. scripts/generate_bindings/dart.py post-processes the output before it is written; see _patch() in that script. The fixes are:

  • async bool returns and the async constructor are emitted synchronously;
  • Browser::close/Page::close collide with the disposer (renamed closeBrowser/closePage);
  • the Browser.launch async constructor (a RustBuffer argument) is stubbed with UnsupportedError, so the whole binding is unusable - it is implemented directly;
  • error payloads are dropped ("extra bytes remaining") - decoded here;
  • Vec<u8> returns keep their UniFFI length prefix - stripped here;
  • the FFI helper symbols use an uniffi_-prefixed library name; the generator is invoked with --crate xcelerate so they match the exported symbols.

Re-check every fix when bumping the generator.

Dart bindings for the xcelerate Rust CDP engine. Dart is not a built-in UniFFI target, so the sources are generated with the external uniffi-bindgen-dart generator (pinned to a release that targets UniFFI 0.31).

Requirements #

  • Dart SDK 3.1+ or Flutter
  • The uniffi-bindgen-dart generator: cargo install uniffi-bindgen-dart
  • The native xcelerate library, shipped as xcelerate.dll / libxcelerate.so / libxcelerate.dylib (copied by the script). It must be built with UniFFI's scaffolding-ffi-buffer-fns feature (enabled in the workspace Cargo.toml), which exports the uniffi_ffibuffer_* entry points this binding calls.

Generate / build #

# from the repository root
cargo install uniffi-bindgen-dart      # once
python scripts/generate_bindings/dart.py

The script assembles a pub package:

bindings/dart/
  pubspec.yaml
  lib/xcelerate.dart
  src/xcelerate.dll / libxcelerate.so / libxcelerate.dylib   # local only

or, once generated, inside this directory:

dart pub get
dart analyze

Usage #

The generated binding loads the native library by name (xcelerate); pass libraryPath when the loader cannot find it:

import 'package:xcelerate/xcelerate.dart';

final config = BrowserConfig(
  headless: true,
  detached: true,
  executablePath: null,           // auto-discover Chrome/Edge
  plugins: ['stealth', 'human'],  // opt into built-in plugins
);
final browser = await Browser.launch(config);
final page = await browser.newPage('https://example.com');
print(await page.title());
await browser.closeBrowser();   // `close` is reserved by the disposer

Plugins load from disk sandboxed (WebAssembly) behind the capability gate; loadPlugin instantiates the entrypoint component the manifest names.

Publishing #

python scripts/publish/dart.py          # regenerate + `dart pub publish --dry-run`
python scripts/publish/dart.py --push   # `dart pub publish --force`

dart pub publish authenticates with a Google account (OAuth on first run) or a PUB_TOKEN in CI. The published package is source-only: the native library is platform-specific, so it is not bundled in the pub package - bundle it with your app and pass libraryPath (or place it where DynamicLibrary.open finds it). The generator still copies the host library under src/ for local runs.

License #

Licensed under either of Apache-2.0 or MIT, at your option.

0
likes
160
points
379
downloads

Documentation

API reference

Publisher

verified publisherchaoswarehq.com

Weekly Downloads

Chrome DevTools Protocol client for Dart/Flutter, backed by the xcelerate Rust core.

Repository (GitHub)
View/report issues

License

Apache-2.0, MIT (license)

Dependencies

ffi

More

Packages that depend on xcelerate