RatelHub / rflutter_alert

RFlutter Alert is super customizable and easy-to-use alert / popup dialog library for Flutter. You may create reusable alert styles or add buttons as much as you want with ease.
https://ratel.com.tr
MIT License
386 stars 117 forks source link

unable to load asset #42

Closed michaelnguyen2021 closed 3 years ago

michaelnguyen2021 commented 4 years ago

The following assertion was thrown resolving an image codec: Unable to load asset: packages/rflutter_alert/assets/images/close.png

When the exception was thrown, this was the stack:

0 PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:221:7)

#1 AssetBundleImageProvider._loadAsync (package:flutter/src/painting/image_provider.dart:484:44) #2 AssetBundleImageProvider.load (package:flutter/src/painting/image_provider.dart:469:14) #3 ImageProvider.resolve... (package:flutter/src/painting/image_provider.dart:327:17) ... Image provider: AssetImage(bundle: null, name: "packages/rflutter_alert/assets/images/close.png") Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#0020d(), name: "packages/rflutter_alert/assets/images/close.png", scale: 1.0)
ulrichmabou commented 4 years ago

I wanted to report the same issue; found this one was already open. I think it's because the 'close' icon was implemented using an AssetImage; it could be implemented with Icons.close instead.


════════ Exception caught by image resource service ════════════════════════════════════════════════ The following assertion was thrown resolving an image codec: Unable to load asset: packages/rflutter_alert/assets/images/close.png

When the exception was thrown, this was the stack:

0 PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:221:7)

#1 AssetBundleImageProvider._loadAsync (package:flutter/src/painting/image_provider.dart:484:44) #2 AssetBundleImageProvider.load (package:flutter/src/painting/image_provider.dart:469:14) #3 ImageProvider.resolve... (package:flutter/src/painting/image_provider.dart:327:17) ... Image provider: AssetImage(bundle: null, name: "packages/rflutter_alert/assets/images/close.png") Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#df6d1(), name: "packages/rflutter_alert/assets/images/close.png", scale: 1.0) ----------------------------------------------------------------------------------------------------
doganozan commented 4 years ago

i have had same issue but i have solved it .My problem was in the pubspec.yaml i used wrong indentation it should be like this

flutter: [2 whitespaces]assets: [4 whitespaces ]- images/close.png

baxterhemingway commented 4 years ago

Same, doesnt seem to be working here either. I notice that it searches for assets/images, which is available in git but not on my local package which flutter installed for me.

Are we supposed to manually download these?

tengfone commented 4 years ago

I have faced the same issue, but base on @doganozan solution, i can assure that by placing the flutter: [2space]assets: [4space]- images/close.png

works

EDIT: Does not work after doing a full restart, previously i just performed a hot restart Screenshot 2020-05-16 at 2 17 29 PM

angrbrd commented 4 years ago

Ran into the same thing, linking to git inside pubspec.yaml like below worked for me.

rflutter_alert:
    git: git://github.com/RatelHub/rflutter_alert.git
ibrahimdevs commented 4 years ago

@michaelnguyen547 , @ulrichmabou , @baxterhemingway , @tengfone , @angrbrd hate this speech but i have to say: "It works on my machine" :) Can you try the latest version V1.1.0 and be sure whitespaces issue which @doganozan mentioned?

ammon-lockwood commented 4 years ago

It looks like the only way to get this to work correctly is to install from github? If I use the recommended rflutter_alert: ^1.1.0 and flutter pub get then it installs the package, however, the package doesn't have any assets so no close image. Seems to me there is a bug in the build. Not sure why there is a difference between using github and not using it.

Also none of the documentation mentions needing to import images. I feel like I'm missing something and this thread is not helping.

my pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2

  # for alert dialogs
  rflutter_alert: ^1.1.0

my packages folder with the package after installing.

Screen Shot 2020-09-22 at 2 48 19 PM

Help, I'm still confused.

ammon-lockwood commented 4 years ago

It looks like the only way to get this to work correctly is to install from github? If I use the recommended rflutter_alert: ^1.1.0 and flutter pub get then it installs the package, however, the package doesn't have any assets so no close image. Seems to me there is a bug in the build. Not sure why there is a difference between using github and not using it.

Also none of the documentation mentions needing to import images. I feel like I'm missing something and this thread is not helping.

my pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2

  # for alert dialogs
  rflutter_alert: ^1.1.0

my packages folder with the package after installing.

Screen Shot 2020-09-22 at 2 48 19 PM

Help, I'm still confused.

Seems as though killing (stopping) the app and starting again from scratch it worked without any errors about the close button.

zafercuz commented 4 years ago

It looks like the only way to get this to work correctly is to install from github? If I use the recommended rflutter_alert: ^1.1.0 and flutter pub get then it installs the package, however, the package doesn't have any assets so no close image. Seems to me there is a bug in the build. Not sure why there is a difference between using github and not using it. Also none of the documentation mentions needing to import images. I feel like I'm missing something and this thread is not helping. my pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^0.1.2

  # for alert dialogs
  rflutter_alert: ^1.1.0

my packages folder with the package after installing.

Screen Shot 2020-09-22 at 2 48 19 PM

Help, I'm still confused.

Seems as though killing (stopping) the app and starting again from scratch it worked without any errors about the close button.

Can confirm it works after killing (stopping) the app and starting again worked. Weird how it does not automatically detects the image once we put it in assets/images.

ibrahimdevs commented 3 years ago

So I'm closing this issue.