findAssetPath method
Implementation
String findAssetPath(String path, String audioType, {String? package}) {
if (audioType == 'network' || audioType == 'liveStream' || audioType == 'file') {
return path;
}
// in web, assets are packaged in a /assets/ folder
// if you want '/asset/3' as described in pubspec
// it will be in /assets/asset/3
/* for release mode, need to change the 'url', remove the /#/ and add /asset before */
if (path.startsWith('/')) {
path = path.replaceFirst('/', '');
}
if (package != null) {
path = 'packages/$package/' + path;
}
path = (window.location.href.replaceAll('/#/', '') + '/assets/' + path);
return path;
}