Hello there! Welcome to this example project demonstrating how to create LibTorrent bindings for the Dart language. I hope you find it helpful and informative.
Everything started from here dart-lang/native#218
Before diving in, make sure you have the following prerequisites installed:
- Ensure libtorrent shared library is installed on your system and recognized by the compiler using the flag
-ltorrent-rasterbar
. - If you have libtorrent source files in a custom path, update the
wrapper/Makefile
accordingly. - You'll also need to have the Dart SDK installed.
- The
wrapper/Makefile
contains various useful rules to streamline the development process:
- debug: Builds a test binary with gdb flag enabled for testing/debugging process.
- run: Similar to
debug
, but it also runs the binary after building. - build: This rule is responsible for building the wrapper library:
libwrapper.so
by default.
- To build the wrapper library, execute the following command:
make build
Once you've built the wrapper library, follow these steps to run the example project:
- Copy the library file
libwrapper.so
into the Dart project directory. - Get dart packages
dart pub get
- Run the project using the following command:
dart run
If you want to dive deeper into LibTorrent, here are some helpful resources:
- LibTorrent Tutorial
- Settings Pack
- Alert Categories
- Alerts
- Parse Magnet URI
- Add Torrent Parameters
- Session Handle
- Torrent Handle
- Torrent Info
- File Storage
- Developing C wrapper API for Object-Oriented C++ code
- How to create a shared library in android and use it in flutter?
Feel free to fork this project or create pull requests if you'd like to contribute. Your feedback and contributions are highly appreciated!