Home > Software design >  Unable to load asset, when filename has accent
Unable to load asset, when filename has accent

Time:01-18

i have a simple SvgPicture.asset("media/cikkcsoport/$cikkcsoportkod.svg") in my code, and if the $cikkcsoportkod has accented value, flutter cannot load the asset.

It works with unaccented filenames, only the accented ones drop error messages like:

════════ Exception caught by SVG ═══════════════════════════════════════════════
The following assertion was thrown resolving a single-frame picture stream:
Unable to load asset: media/cikkcsoport/AÍ.svg

When the exception was thrown, this was the stack
#0      PlatformAssetBundle.load
package:flutter/…/services/asset_bundle.dart:258
<asynchronous suspension>
#1      AssetBundle.loadString
package:flutter/…/services/asset_bundle.dart:83
<asynchronous suspension>
#2      AssetBundlePictureProvider._loadAsync
package:flutter_svg/src/picture_provider.dart:546
<asynchronous suspension>
Picture provider: ExactAssetPicture(name: "media/cikkcsoport/AÍ.svg", bundle: null, colorFilter: null)
Picture key: AssetBundlePictureKey(bundle: PlatformAssetBundle#17a4a(), name: "media/cikkcsoport/AÍ.svg", colorFilter: null, theme: SvgTheme(currentColor: Color(0xff000000), fontSize: 14.0, xHeight: 7.0))
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by SVG ═══════════════════════════════════════════════
Unable to load asset: media/cikkcsoport/AÓ.svg
════════════════════════════════════════════════════════════════════════════════

════════ Exception caught by SVG ═══════════════════════════════════════════════
Unable to load asset: media/cikkcsoport/AÁ.svg
════════════════════════════════════════════════════════════════════════════════

How can I resolve this problem?

CodePudding user response:

I think You should always use small characters with underscores for the asset name, that way you assets can be differentiated and it will stay organized

CodePudding user response:

Try with the below things.

I hope this things are solve your issue.

  • Related