API ReferenceFlutter
ZeticMLangeModel
API reference for general model inference in Flutter.
This page reflects zetic_mlange 1.9.1.
ZeticMLangeModel loads a general on-device model from the Melange registry and runs tensor inference from Dart.
Import
import 'package:zetic_mlange/zetic_mlange.dart';create
static Future<ZeticMLangeModel> create({
required String personalKey,
required String name,
int? version,
ModelMode modelMode = ModelMode.runAuto,
QuantType? quantType,
Target? target,
APType apType = APType.na,
MlangeProgressCallback? onProgress,
ZeticMLangeCacheHandlingPolicy cacheHandlingPolicy =
CacheHandlingPolicy.removeOverlapping,
})| Parameter | Type | Default | Description |
|---|---|---|---|
personalKey | String | - | Personal key for accessing the model. |
name | String | - | Model name in account_name/project_name format. |
version | int? | null | Model version. null loads the latest version. |
modelMode | ModelMode | runAuto | Backend selection strategy. |
quantType | QuantType? | null | Optional precision filter. |
target | Target? | null | Optional backend target filter. |
apType | APType | na | Optional processor filter. |
onProgress | MlangeProgressCallback? | null | Download progress callback from 0.0 to 1.0. |
cacheHandlingPolicy | ZeticMLangeCacheHandlingPolicy | removeOverlapping | Managed artifact cache cleanup policy. |
final model = await ZeticMLangeModel.create(
personalKey: personalKey,
name: 'account_name/project_name',
);run
Runs inference with tensors matching the model input order.
List<Tensor> run([List<Tensor> inputs = const []])| Parameter | Type | Description |
|---|---|---|
inputs | List<Tensor> | Input tensors matching the model's expected shapes and data types. |
Returns: output tensors in model output order.
final outputs = model.run([inputTensor]);
final firstOutput = outputs.first;Lifecycle
bool get isClosed
void close()Call close() when the model is no longer needed.
model.close();