tree: dda48f6cfec6c92c354eb9f857c3355765fac2a8 [path history] [tgz]
  1. bin/
  2. hook/
  3. lib/
  4. src/
  5. .gitignore
  6. pubspec.yaml
  7. README.md
pkg/record_use/test_data/drop_dylib_recording/README.md

This sample builds a native library for adding and multiplying. It then uses the recorded usages feature to tree-shake unused libraries out.

Usage:

Keep all:

dart --enable-experiment=native-assets,record-use build bin/drop_dylib_recording_all.dart

The lib/ folder now contains both libraries

./bin/drop_dylib_recording_all/drop_dylib_recording_all.exe add

Prints Hello world: 7!

Treeshake using calls:

dart --enable-experiment=native-assets,record-use build bin/drop_dylib_recording_calls.dart

The lib/ folder now contains only the add library.

./bin/drop_dylib_recording_calls/drop_dylib_recording_calls.exe

Prints Hello world: 7!

Treeshake using instances:

dart --enable-experiment=native-assets,record-use build bin/drop_dylib_recording_instances.dart

The lib/ folder now contains only the add library.

./bin/drop_dylib_recording_calls/drop_dylib_recording_instances.exe

Prints Hello world: 7!