CoreMLHostApi class

Only registered when Core ML's iOS 18 / macOS 15 surface is available.

Constructors

CoreMLHostApi({BinaryMessenger? binaryMessenger, String messageChannelSuffix = ''})
Constructor for CoreMLHostApi. The binaryMessenger named argument is available for dependency injection. If it is left null, the default BinaryMessenger will be used which routes to the host platform.

Properties

hashCode → int
The hash code for this object.
no setterinherited
pigeonVar_binaryMessenger → BinaryMessenger?
final
pigeonVar_messageChannelSuffix → String
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

allComputeDevices() → Future<List<ComputeDeviceMessage>>
MLComputeDevice.allComputeDevices.
assetModelDescription(String compiledPath, String? functionName) → Future<ModelDescriptionMessage>
MLModelAsset.modelDescription, optionally of one function.
availableComputeDevices() → Future<List<ComputeDeviceMessage>>
MLModel.availableComputeDevices.
compileModel(String path, String? destinationPath) → Future<String>
MLModel.compileModel(at:). Compiles a .mlmodel or .mlpackage to a .mlmodelc directory. When destinationPath is given the result is moved there (replacing anything already at that path) and that path is returned; otherwise Core ML's temporary path is returned.
encodeImage(PixelBufferMessage image, ImageEncodingMessage encoding, double quality) → Future<Uint8List>
Encodes an image feature value as PNG or JPEG, for display in Dart.
functionNames(String compiledPath) → Future<List<String>>
MLModelAsset.functionNames for a compiled model.
liveHandleCount() → Future<int>
loadModel(String compiledPath, ModelConfigurationMessage configuration) → Future<ModelInfoMessage>
MLModel.load(contentsOf:configuration:).
makeState(int modelHandle) → Future<int>
MLModel.makeState().
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
predict(PredictionRequestMessage request) → Future<PredictionResultMessage>
MLModel.prediction(from:options:), or prediction(from:using:options:) when the request carries a state handle.
predictBatch(BatchPredictionRequestMessage request) → Future<BatchPredictionResultMessage>
MLModel.predictions(from:options:).
readState(int stateHandle, String stateName) → Future<MultiArrayMessage>
Copies a state buffer into Dart (MLState.withMultiArray(for:)).
release(int handle) → Future<void>
Releases a model or state handle.
releaseAll() → Future<int>
Releases every handle owned by this engine. Returns how many were freed.
toString() → String
A string representation of this object.
inherited
writeState(int stateHandle, String stateName, MultiArrayMessage array) → Future<void>
Overwrites a state buffer. The data type and shape must match.

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Constants

pigeonChannelCodec → const MessageCodec<Object?>