just_image_flutter 1.0.0
just_image_flutter: ^1.0.0 copied to clipboard
Zero-config Flutter plugin for just_image. Bridges the Rust-powered image processing engine to Flutter apps on Android, iOS, macOS, Linux, and Windows via Native Assets. Pure FFI linking — no widgets.
just_image_flutter #
Zero-config Flutter plugin for just_image —
bridges the Rust-powered image processing engine to Flutter apps via
Native Assets.
This package contains no widgets or UI code. It exists solely to declare
ffiPlugin: true for all platforms, which tells Flutter's build system to
invoke the hook/build.dart in just_image and bundle the compiled Rust
library into your app binary.
Installation #
dependencies:
just_image_flutter: ^1.0.0
That's it. No platform-specific setup, no CMakeLists.txt, no Podspec, no Gradle changes.
Prerequisites #
- Flutter >= 3.22.0 (Dart SDK >= 3.10.8)
- Rust toolchain installed (rustup.rs)
- Native Assets experiment flag when building:
flutter run --enable-experiment=native-assets flutter build apk --enable-experiment=native-assets
Platform-specific Rust targets #
For Android:
rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android
For iOS:
rustup target add aarch64-apple-ios x86_64-apple-ios
For macOS, Linux, and Windows the default host target is sufficient.
Usage #
Import the package — the full just_image API is re-exported:
import 'package:just_image_flutter/just_image_flutter.dart';
final result = await ImagePipeline(imageBytes)
.resize(1920, 1080)
.sharpen(1.5)
.toFormat(ImageFormat.avif)
.quality(85)
.execute();
File('output.avif').writeAsBytesSync(result.data);
How it works #
┌──────────────────────────────────────────────┐
│ Your Flutter App │
│ │
│ ┌────────────────────────────────────────┐ │
│ │ just_image_flutter │ │
│ │ ffiPlugin: true (all platforms) │ │
│ │ export just_image API │ │
│ └───────────────┬────────────────────────┘ │
│ │ depends on │
│ ┌───────────────▼────────────────────────┐ │
│ │ just_image (core) │ │
│ │ ImagePipeline → NativeBridge (FFI) │ │
│ │ hook/build.dart (Native Assets) │ │
│ └───────────────┬────────────────────────┘ │
│ │ compiles automatically │
│ ┌───────────────▼────────────────────────┐ │
│ │ Rust native library │ │
│ │ image codecs, transforms, SIMD │ │
│ └────────────────────────────────────────┘ │
└──────────────────────────────────────────────┘
ffiPlugin: truetells Flutter to look for Native Assets hooks in dependencieshook/build.dartinjust_imagedetects the target OS and architecture- Cargo cross-compiles the Rust crate for the target
- Flutter bundles the
.so/.dylib/.dllinto the app binary dart:ffiDynamicLibrary.open()loads it at runtime
Platform support #
| Platform | Architectures | Notes |
|---|---|---|
| Android | arm64, arm, x64 | Requires NDK + Rust targets |
| iOS | arm64, x64 | Simulator via x64 |
| macOS | arm64, x64 | — |
| Linux | x64, arm64 | — |
| Windows | x64, arm64 | MSVC toolchain required |
License #
See LICENSE.