dark_matter 0.0.1-dev.2 copy "dark_matter: ^0.0.1-dev.2" to clipboard
dark_matter: ^0.0.1-dev.2 copied to clipboard

unlistedoutdated

Painting pixels in the dark.

DARK MATTER
Render Flutter pixels in the dark.

This project is maintained by the Flutter Bounty Hunters. Would you like your feature added to this project? Fund a milestone today!

How to use #

Dark Matter is a Dart package, but it depends on some non-Dart internal tooling. Follow these instructions to get up and running.

(Optional) Build the capture library #

The Dark Matter mono-repo includes a project called "capture". Capture is a C++ project that talks to a Flutter engine, and FFMPEG. The Dark Matter Dart package needs a build of Capture to render pixels to video.

The Dark Matter project comes with a few pre-built versions of Capture:

  • Mac: /dark_matter/libcapture.dylib (x86 only)
  • Windows: /dark_matter/libcapture.dll
  • Linux: /dark_matter/libcapture.so

Depending on your use-cases, you may need to build the Capture project yourself. If so, follow the instructions in /capture/README.md to build the capture library for your host machine.

Instrument your app #

You Flutter app needs to tell Dark Matter when to start recording, and when to stop recording.

Instrument your Flutter code with appropriate start/stop calls.

import 'package:dark_matter_recorder/dark_matter_recorder.dart';

// Before you start recording, wait for Dark Matter to initialize.
await DarkMatterRecorder.waitForSync();

// When you're ready to record pixels, start the recorder.
await DarkMatterRecorder.start();

// When you're done recording pixels, stop the recorder.
await DarkMatterRecorder.stop();

Build your Flutter app in JIT mode #

Find your Flutter app that you want to record. Build your app in just-in-time (JIT) mode. If you compile your Flutter code in debug mode or profile mode, your code will be compiled in JIT mode.

flutter build bundle --debug

or

flutter build bundle --profile

Activate Dark Matter as a global Dart package #

Activate the dark_matter package as a global Dart package, so that you can run Dark Matter from the terminal, within any directory on your machine.

dart pub global activate dark_matter

or

flutter pub global activate dark_matter

Run the Dark Matter CLI to render a video of your Flutter UI #

Run the dark_matter package to render your Flutter UI to video.

# Run dark_matter as a global package
darkmatter
  --projectPath=path/to/flutter/project
  --width=720
  --height=480
  --format=mp4
  --output=myvideo.mp4

Dark Matter outputs an mp4 video called myvideo.mp4.

Limitations #

Only supports x86 architecture #

Currently, dark_matter downloads the Flutter engine distributions as provided by the Flutter team. These distributions are only available with an x86 architecture, as of writing this limitation. When/if the Flutter team provides M1/ARM versions of the publicly available compiled engine, dark_matter can incorporate that architecture, and this limitation will be eliminated.

Only supports JIT Flutter code #

Currently, dark_matter configures the Flutter engine to run JIT code, only. If a funding company would like to add support for AOT code, we can schedule that work.

Future Improvements #

  • Find icudtl.dat in the user's Flutter distro, instead of packaging it
0
likes
0
points
15
downloads

Publisher

verified publisherflutterbountyhunters.com

Weekly Downloads

Painting pixels in the dark.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

args, ffi, path

More

Packages that depend on dark_matter