tree: e0a73bdc4bc1d3b390c5e5994ef1ae27e66c8489 [path history] [tgz]
  1. hook/
  2. lib/
  3. test/
  4. pubspec.yaml
  5. README.md
pkgs/hooks/example/build/system_library/README.md

An example of a Dart library using a native system libary.

Note

Note that most system libraries on operating systems will not be available as a C API. On MacOS/iOS, FFIgen and Swiftgen will need to be used to access the APIs only available in Objective-C or Swift. On Android, JNIgen will need to be used to access the APIs only available in Java or Kotlin. This package only details how to use C APIs. For using system APIs with FFIgen, JNIgen, and Swiftgen refer to the documentation in these packages.

Usage

Run tests with dart --enable-experiment=native-assets test.

Code organization

A typical layout of a package which uses system libraries:

  • hook/build.dart declares the system libraries used.
  • lib/ contains Dart code which uses the system libraries.