pollux_polyglot_flutter_adapter 0.1.0
pollux_polyglot_flutter_adapter: ^0.1.0 copied to clipboard
Official Flutter and Dart adapter for Pollux Core deterministic authority sandboxing and capability evaluation.
pollux_polyglot_flutter_adapter #
Official Flutter and Dart adapter for Pollux Core deterministic authority sandboxing and capability evaluation across platforms.
Features #
- Deterministic Authority Sandboxing: Evaluate operation candidates against immutable Authority Manifest policies.
- Cross-Platform FFI Integration: High-performance C ABI bridge (
pollux-abi/1) supporting macOS, iOS, Windows, Linux, and Android. - Zero-Copy Memory Safety: Managed pointer allocation and deallocation through
dart:ffiandpackage:ffi. - Structured Audit Traces: Receive structured decision verdicts (
allow/deny) and execution trace metrics for observability. - Strong Typing: Idiomatic Dart models for operations, manifests, evaluation verdicts, and exception hierarchies.
Getting started #
Prerequisites #
- Dart SDK:
^3.3.0 - Flutter SDK:
^3.19.0 - Pollux Core native binary:
pollux_ffi.dll(Windows),libpollux_ffi.dylib(macOS/iOS), orlibpollux_ffi.so(Linux/Android).
Installation #
Add pollux_polyglot_flutter_adapter to your pubspec.yaml dependencies:
flutter pub add pollux_polyglot_flutter_adapter
Or manually:
dependencies:
pollux_polyglot_flutter_adapter: ^0.1.0
Native Library Setup #
The adapter dynamically discovers the native library in standard locations:
- System library paths (
/usr/local/lib,/opt/homebrew/lib,PATH, etc.) - Next to your application executable or script
- Custom location via environment variables
POLLUX_CORE_LIBorPOLLUX_FFI_PATH - Custom path passed directly to
PolluxEngine.load(manifest, customLibraryPath: '/path/to/lib')
Usage #
Here is a complete, minimal example showing how to initialize an engine, evaluate filesystem operations, and dispose of the instance:
import 'package:pollux_polyglot_flutter_adapter/pollux_polyglot_flutter_adapter.dart';
void main() {
// 1. Define an Authority Manifest
const manifest = '''
version: 1
filesystem:
read:
- ./assets
- /tmp
''';
// 2. Initialize the Pollux Engine
final engine = PolluxEngine.load(manifest);
print('Pollux ABI Version: ${engine.abiVersion}');
print('Pollux Core Version: ${engine.coreVersion}');
// 3. Evaluate a permitted filesystem read operation
final readOp = Operation.fileRead('./assets');
final readResult = engine.evaluate(readOp);
print('Read Verdict: ${readResult.outcome} (Allowed: ${readResult.isAllowed})');
// 4. Evaluate an unauthorized filesystem write operation
final writeOp = Operation.fileWrite('./assets');
final writeResult = engine.evaluate(writeOp);
print('Write Verdict: ${writeResult.outcome} (Allowed: ${writeResult.isAllowed})');
// 5. Clean up native resources
engine.dispose();
}
Evaluating Custom Operations #
You can evaluate network or custom operations using domain constructors:
// Network connect check
final netOp = Operation.netConnect('api.internal:443');
final netResult = engine.evaluate(netOp);
// Process spawn check
final cmdOp = Operation.processSpawn('/bin/sh');
final cmdResult = engine.evaluate(cmdOp);
// Custom operation domain
final customOp = Operation.custom(
capability: 'execute',
resourceDomain: 'custom_domain',
resourceValue: 'res://service',
);
final customResult = engine.evaluate(customOp);
Architecture #
pollux_polyglot_flutter_adapter connects Flutter applications to Pollux Core via dart:ffi:
┌───────────────────────────────────────────────┐
│ Flutter / Dart App │
└───────────────────────▲───────────────────────┘
│ Dart API
┌───────────────────────▼───────────────────────┐
│ PolluxEngine / Operation Model │
└───────────────────────▲───────────────────────┘
│ dart:ffi
┌───────────────────────▼───────────────────────┐
│ Native Bridge (pollux-abi/1 C Header) │
└───────────────────────▲───────────────────────┘
│ Native Call
┌───────────────────────▼───────────────────────┐
│ libpollux_ffi (Rust / Core Sandboxing) │
└───────────────────────────────────────────────┘
Additional information #
Source Code and Issues #
- Repository: https://github.com/sxnnyside-project/pollux-polyglot-flutter-adapter
- Issue Tracker: https://github.com/sxnnyside-project/pollux-polyglot-flutter-adapter/issues
Contributing #
Contributions, feedback, and security reviews are welcomed. Please review CONTRIBUTING.md and CODE_OF_CONDUCT.md before submitting pull requests.
License #
This project is licensed under the MIT License.
Pollux Polyglot Flutter Adapter — A Sxnnyside Project
© 2026 Sxnnyside Project