createFromAsset static method

Future<IsolateInterpreter> createFromAsset(
  1. String assetName, {
  2. String debugName = 'FlutterTfLiteInterpreterIsolate',
  3. InterpreterOptions? options,
})

Creates interpreter from a assetName

Place your .tflite file in your assets folder.

Example:

final interpreter = await FlutterInterpreter.fromAsset('assets/your_model.tflite');

Implementation

static Future<IsolateInterpreter> createFromAsset(String assetName, {
  String debugName =  'FlutterTfLiteInterpreterIsolate',
  InterpreterOptions? options}) async {

  Uint8List buffer = await getBufferFromAsset(assetName);
  return await IsolateInterpreter.createFromBuffer(buffer,
    debugName: debugName, options: options);

}