Melange
API ReferenceFlutter

Enums and Constants

Flutter enum and support types for zetic_mlange.

This page reflects zetic_mlange 1.11.1.

General Model Types

TypeValues
ModelModerunAuto, runFp32, runQuantized, runSpeed, runAccuracy
APTypecpu, gpu, npu, na
ModelCacheHandlingPolicyremoveOverlapping, keepExisting

Target contains backend identifiers used by selected general-model artifacts. Most Flutter apps use ModelMode.

LLM Types

TypeValues
LLMModelModerunAuto, runSpeed, runAccuracy
LLMTargetllamaCpp, litertLm, mllm
LLMQuantTypeGGUF quantization variants such as ggufQuantF16, ggufQuantQ4KM, and ggufQuantQ80
LLMKVCacheCleanupPolicycleanUpOnFull, doNotCleanUp
KVStateStatusok, notSupported, invalidArgument, fileNotFound, ioError, corrupt, modelMismatch, contextTooSmall

LLMInitOption

final class LLMInitOption {
  const LLMInitOption({
    this.kvCacheCleanupPolicy = LLMKVCacheCleanupPolicy.cleanUpOnFull,
    this.nCtx = 2048,
  });
}
FieldDefaultDescription
kvCacheCleanupPolicycleanUpOnFullIn-memory KV-cache behavior when context storage is full.
nCtx2048Requested context size. The runtime may normalize it.

Result and Error Types

TypePurpose
LLMNextTokenResultToken result returned by waitForNextToken().
MlangeExceptionDart exception for validation and native SDK failures.
MlangeKVExceptionTyped exception carrying a non-OK KVStateStatus.
MlangeProgressCallbackDownload progress callback from 0.0 to 1.0.

Background Download Types

TypeValues or purpose
BackgroundDownloadHandleDurable job identifier returned by downloadInBackground(...); retain it to query or stop the job.
BackgroundDownloadStatequeued, resolving, downloading, verifying, installed, failed, stopped
BackgroundDownloadStatusLatest job snapshot: handle, state, downloaded bytes, optional total bytes, optional error message, progress, and isTerminal.
BackgroundDownloadStopResultstopped, alreadyFinished, notFound
ModelRemovalResultRemoval outcome: removed, isInUse, deletedFiles, and deletedBytes.

installed, failed, and stopped are terminal states. If ModelRemovalResult.isInUse is true, close active model instances before retrying removal.

On this page