fromAsset method

  1. @override
Future<GLTFData?> fromAsset(
  1. String asset, {
  2. String? package,
})
override

asset - path of the file to be loaded

package - if the file is from another flutter package add the name of the package here

Implementation

@override
Future<GLTFData?> fromAsset(String asset, {String? package}) async{
  _init();
  if(path == ''){
    setPath(asset.replaceAll(asset.split('/').last, ''));
  }
  ThreeFile? tf = await _loader.fromAsset(asset,package: package);
  return tf == null?null:_parse(tf.data);
}