executorch_dart library
ExecuTorch on-device ML inference for pure Dart.
Runs ExecuTorch models on Android, iOS, macOS, Linux, and Windows through dart:ffi and native assets. Works in any Dart program, including servers and command-line tools — no Flutter required.
import 'package:executorch_dart/executorch_dart.dart';
final model = await ExecuTorchModel.load('/path/to/model.pte');
final outputs = await model.forward([inputTensor]);
await model.dispose();
Flutter applications should depend on executorch_flutter instead, which
adds asset-bundle loading and web support on top of this package.
Classes
- BackendQuery
- Query functions for hardware acceleration backend availability.
- ExecuTorchLLM
- On-device large language model for streaming text generation.
- ExecutorchManager
- High-level manager for ExecuTorch inference operations
- ExecutorchManagerBase
- Base implementation of ExecutorchManager with shared logic
- ExecuTorchModel
- High-level wrapper for an ExecuTorch model instance
-
ExecuTorchPostprocessor<
R> - Abstract base class for output postprocessing
-
ExecuTorchPreprocessor<
T> - Abstract base class for input preprocessing
-
ExecuTorchProcessor<
T, R> - Abstract base class combining preprocessing and postprocessing
- ExecuTorchVersion
- Library version information.
- GenConfig
-
Generation parameters for
ExecuTorchLLM.generate. - ModelLoadResult
- Model loading result.
- ProcessorTensorUtils
- Utility class for tensor operations in processors
- TensorData
- Tensor data for input/output.
- TensorUtils
- Utility class for working with ExecuTorch tensors
- Tokenizer
- Converts text to token ids and back, independently of any model.
Enums
- Backend
- Hardware acceleration backends supported by ExecuTorch.
- TensorType
- Tensor data type enumeration.
- TokenizerFormat
- Tokenizer formats the native library can read.
Extensions
- TensorTypeExtension on TensorType
- Deprecated extension providing backward compatibility for ExtendedTensorType.
Constants
- executorchVersion → const String
- ExecuTorch version this plugin is built against.
Functions
-
setNativeDebugLogging(
bool enabled) → void - Set debug logging on or off.
Typedefs
- ExtendedTensorType = TensorType
- Deprecated alias for TensorType.
Exceptions / Errors
- ExecuTorchException
- Base exception class for all ExecuTorch-related errors.
- ExecuTorchInferenceException
- Inference execution errors.
- ExecuTorchIOException
- Network and file I/O errors.
- ExecuTorchMemoryException
- Memory and resource errors.
- ExecuTorchModelException
- Model loading and lifecycle errors.
- ExecuTorchPlatformException
- Platform-specific integration errors.
- ExecuTorchValidationException
- Tensor validation and data errors.
- GenericProcessorException
- Generic processor exception implementation.
- InvalidInputException
- Exception thrown for invalid processor input.
- InvalidOutputException
- Exception thrown for invalid processor output.
- PostprocessingException
- Exception thrown during postprocessing operations.
- PreprocessingException
- Exception thrown during preprocessing operations.
- ProcessorException
- Base exception class for processor-related errors.