The readme says that the model should be under the file's root directory, but the flutter_gemma plugin code refers to the app's document directory.
I could run this plugin after manually moving the model file to the app's document.
Here's the code I use to move the model file.
final docDir = await getApplicationDocumentsDirectory();
final model = await rootBundle.load('assets/model.bin');
final modelBytes = model.buffer.asUint8List(model.offsetInBytes, model.lengthInBytes);
await File(p.join(docDir.path, 'model.bin')).writeAsBytes(modelBytes);
And also, line 17 of ios/classes/InferenceModel.swift should be
self.inference = try! LlmInference(options: llmOptions)
or
Use do / catch
The readme says that the model should be under the file's root directory, but the flutter_gemma plugin code refers to the app's document directory. I could run this plugin after manually moving the model file to the app's document. Here's the code I use to move the model file.
And also, line 17 of
ios/classes/InferenceModel.swift
should bein case the model file does not exist.