load method
Implementation
@override
Future<bool> load(VoltronBridgeManager bridge, Callback callback) async {
if (isEmpty(_assetPath)) {
return false;
}
var result = false;
var watch = Stopwatch();
watch.start();
String uri = _assetPath;
if (!_assetPath.startsWith('assets://')) {
if (_assetPath.startsWith("/")) {
uri = 'assets:/$_assetPath';
} else {
uri = 'assets://$_assetPath';
}
}
try {
result = await bridge.runScriptFromUri(uri, canUseCodeCache, codeCacheTag, (value) {
watch.stop();
LogUtils.profile("runScriptFromAssets", watch.elapsedMilliseconds);
callback(value, null);
});
} catch (e) {
callback(-1, StateError(e.toString()));
}
return result;
}