runScriptFromUri method

Future<bool> runScriptFromUri(
  1. String uri,
  2. bool canUseCodeCache,
  3. String codeCacheTag,
  4. CommonCallback callback,
)

Implementation

Future<bool> runScriptFromUri(String uri, bool canUseCodeCache,
    String codeCacheTag, CommonCallback callback) async {
  if (!_isFrameWorkInit) {
    return false;
  }
  if (!isEmpty(codeCacheTag) && !isEmpty(sCodeCacheRootDir)) {
    LogUtils.i(_kTag,
        "runScriptFromUri ======core====== $codeCacheTag${", canUseCodeCache == $canUseCodeCache"}");
    var codeCacheDir = sCodeCacheRootDir! + codeCacheTag + Platform.pathSeparator;

    await VoltronApi.runScriptFromUri(
        _engineId, _context.vfsManager.id, uri, codeCacheDir, canUseCodeCache, isAssetsUrl(uri), (value) {
      callback(value);
    });
  } else {
    LogUtils.i(_kTag, 'runScriptFromUri codeCacheTag is null');

    var codeCacheDir = '$codeCacheTag${Platform.pathSeparator}';
    await VoltronApi.runScriptFromUri(
        _engineId, _context.vfsManager.id, uri, codeCacheDir, false, isAssetsUrl(uri), (value) {
      callback(value);
    });
  }

  return true;
}