hasActiveModel static method

bool hasActiveModel()

Check if there's an active inference model

Returns true if an inference model has been installed and set as active.

Example:

if (FlutterGemma.hasActiveModel()) {
  final model = await FlutterGemma.getActiveModel();
  // Use model...
} else {
  // Install model first
}

Implementation

static bool hasActiveModel() {
  final manager = FlutterGemmaPlugin.instance.modelManager;
  return manager.activeInferenceModel is InferenceModelSpec;
}