isModelInstalled property

  1. @override
Future<bool> get isModelInstalled
override

Whether the model is installed (i.e. downloaded, copied from assets or path to the file is set manually) and ready to be initialized and used.

Implementation

@override
Future<bool> get isModelInstalled async {
  if (_modelCompleter != null) return await _modelCompleter!.future;

  final prefs = await _prefs;
  final name = prefs.getString(_prefsModelKey);
  if (name == null) return false;

  _modelFileName = name;
  final file = await _modelFile;
  return file != null && await file.exists();
}