installModelFromAssetWithProgress method

  1. @override
Stream<int> installModelFromAssetWithProgress(
  1. String path, {
  2. String? loraPath,
})
override

Installs model from Flutter assets with progress tracking (debug only)

Implementation

@override
Stream<int> installModelFromAssetWithProgress(String path, {String? loraPath}) async* {
  if (kReleaseMode) {
    throw UnsupportedError("Asset model loading is not supported in release builds");
  }

  await _ensureInitialized();

  // For web assets, we simulate progress
  for (int progress = 0; progress <= 100; progress += 10) {
    yield progress;
    if (progress < 100) {
      await Future.delayed(const Duration(milliseconds: 50));
    }
  }

  await installModelFromAsset(path, loraPath: loraPath);
}