Repository: flutter
Issue: [flutter_svg] Unable to load assets is not fixed
Labels: package,p: flutter_svg

_Imported from https://github.com/dnfield/flutter_svg/issues/579_

Original report by @Ankit0080 on Jul 29, 2021

This is my Pubspec.yaml file

version: 1.0.0+1

environment:
  sdk: ">=2.7.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  fluttertoast: ^3.1.3
  page_transition: "^1.1.7+2"
  
  


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.0
  json_annotation: ^3.1.1
  shared_preferences: ^2.0.5
  flutter_svg: ^0.22.0

 
 

dev_dependencies:
  build_runner: ^1.11.5
  json_serializable: ^3.5.1
  flutter_test:
    sdk: flutter
  http: any
  
  
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter.
flutter:

  # The following line ensures that the Material Icons font is
  # included with your application, so that you can use the icons in
  # the material Icons class.
  uses-material-design: true
  

  assets:
    - assets/
    

  # An image asset can refer to one or more resolution-specific "variants", see
  # https://flutter.dev/assets-and-images/#resolution-aware.

  # For details regarding adding assets from package dependencies, see
  # https://flutter.dev/assets-and-images/#from-packages

  # To add custom fonts to your application, add a fonts section here,
  # in this "flutter" section. Each entry in this list should have a
  # "family" key with the font family name, and a "fonts" key with a
  # list giving the asset and other descriptors for the font. For
  # example:
  fonts:
    - family: NotoSansMedium
      fonts:
        - asset: assets/fonts/NotoSans-Medium.ttf
    - family: NotoSansBold
      fonts:
        - asset: assets/fonts/NotoSans-Bold.ttf
    - family: NotoSansRegular
      fonts:
        - asset: assets/fonts/NotoSans-Regular.ttf
    - family: NotoSansItalic
      fonts:
        - asset: assets/fonts/NotoSans-Italic.ttf
       
\

This is my svg loading code

Row(
                                  children: <Widget>[
                                    SvgPicture.asset("assets/calendar.svg")
                                  ],
                                )

Expected behaviour : Should work 

Result : Unable to load asets throwing exception i have put image name and the image is stored in asstest folder


---
Comment by @marcov-dart on Jul 30, 2021
Pretty sure this is unrelated to this package. 

It is odd though, because it I have it working. I have cupertino_icons and uses-material-design: true, svg assets, png assets and fonts setup in pubspec.yaml.
I do have stop the app after adding an asset, then run flutter pub get and then start it again. Flutter pub get and then restart does not work for me with the Unable to load assets exception being thrown. But that is not related to svg assets alone. The same is true for the png assets.

Also make sure you have the indentation correct in the pubspec.yaml. It is stupidly sensitive to indentation.



---
Comment by @AndrejBykov on Aug 16, 2021
I have the same issue, and i used in parallel flutter  image.asset widget which loaded the assets files, but the svgPicture.asset unable to load asset

---
Comment by @AndrejBykov on Aug 16, 2021
This is shame because what for then this package benn created if it doesn't provide what expected

---
Comment by @Ankit0080 on Sep 29, 2021
"Unable to load assets"   everytime this package throw this exception.

---
Comment by @dnfield on Sep 29, 2021
I'd need  a full reproduction of this. This is likely an issue with the way the pubspec is set up in the project rather than this package.