readEngineBundle function

Future<EngineBundle> readEngineBundle(
  1. String path
)

What Engine.create reads of path before any engine exists: its bundle info, or null when the file is not one this package reads; an incomplete file is refused.

Implementation

Future<EngineBundle> readEngineBundle(String path) async {
  try {
    return EngineBundle._(path, await readBundleInfo(path));
  } on LiteRtLmBundleException catch (e) {
    if (e.problem == LiteRtLmBundleProblem.incomplete) rethrow;
    runtimeLog('[LiteRtLmEngine] $e; loading without reading the file');
  } on FileSystemException catch (e) {
    runtimeLog('[LiteRtLmEngine] $e; loading without reading the file');
  }
  return EngineBundle._(path, null);
}