How to load image that fails with 'Unable to load asset:...' - flutter

My flutter app does not show the album art of my music files that I'm trying to load with AssetImage().
I debugged all the way down to asset_bundle.dart and asset is null as you can see in this debugging screenshot:
When I check out that image file on my phone and open it with any image displaying app it works.
Could the fact that the file ending is missing be the problem?
If so, how can I tell my app to try to interpret such files without a file ending as .png?
If you're curious about the exact code of the project: here

Related

flutter-web) how to capture whole screen and save it to gallery

I am running a project with a flutter web
and i need to capture whole screen and save it directly to gallery or photos
but the methods and packages what I have used downloads only as a file
does anyone knows some packages or methods to capture screen and save directly to the gallery??
Do you try this package: ScreenShot

Maui Application Cannot Find Splash Screen Resource

The Package.appxmanifest in my Maui application (latest version, .NET 6, VS 17.4 Preview 1) cannot "find" the Splash Screen file I specify in the Splash Screen field, resulting in a DEP0700 error (see below).
The Visual Assets tab of the Package.appxmanifest looks like this:
The Resources\Splash\mysplash.png file sits on disk as mysplash.svg:
It's my understanding that Maui converts the svg file to a png file during compilation and that the app manifest should reference the png file as a result.
For the record, I also tried these path/file name references in the Splash Screen field before recompiling and none of them worked:
Resources\Splash\mysplash.png
Splash\mysplash.png
mysplash.png
Resources\Splash\mysplash.svg
Splash\mysplash.svg
mysplash.svg
I get this when building:
DEP0700: Registration of the app failed. [0x80073CF6] AppxManifest.xml(33,27): error 0x80070003: Cannot install or update package 0ecaf7bf-457c-450a-94a5-181406568f05_9zz4h110yvjzm because the splash screen image [mysplash.png] cannot be located. Verify that the package contains an image that can be used as a splash screen for the application, and that the package manifest points to the correct location in the package where this splash screen image can be found.
EDIT: The Build Action is indeed set to MauiSplashScreen.
This really should be so difficult. It would be great if the error message provided gave a clue as to where the system is looking for the file, if the file is there but is just in the wrong format, or some other clues...
Does anyone have any ideas?

Is there a way to specify the file name in advance for the picture taken with the flutter camera plugin?

Hi I am using the flutter camera plugin and it works fine, the main issue I am having is that I can't find a way to tell the plugin the image file name when taking the picturee, in android using Kotlin this would be something like:
photoUri = FileProvider.getUriForFile(requireActivity(), "io.awesomedomain", photoFile) // build uri on the app storage space and specific file name -> photoFile.
captureImageIntent.putExtra(MediaStore.EXTRA_OUTPUT, photoUri) // define the pic name before picture is actually taken by the camera.
startActivityForResult(captureImageIntent, REQUEST_PHOTO) // start the camera
I am currently just renaming the picture file name after the picture XFile returns from the flutter camera plugin but this doesn't feel optimal so I am wondering if I am missing something. Is it possible to specify the file name in advance to the flutter camera plugin?
I am currently using the latest available version at the moment: camera: ^0.7.0+2
OK, it looks like I had a misunderstanding of the Camera plugin, I noticed that the returned XFile places the picture in the cache directory and actually provides a method to save the picture to a more definitive storage xfile.saveTo so I did:
var appDir = appDocDirectory.parent.path; // get app directory
file.saveTo('$appDir${Platform.pathSeparator}files${Platform.pathSeparator}${weightPicture.pictureFileName}');
So the picture is properly saved under $myAppDir/files/picName.jpg where the files is a directory I configured to have permission to write to and the picName is defined by the application as I wanted.

JavaFX 2.2 generated image not shown after building jar-file

In my JavaFX Application I generate a barcode with barcode4j by Apache, save it as png image in the directory /data/images/ and embed it in a web page which is shown on a JavaFX WebView.
After generating the barcode I embend it into the webpage using the following Javascript-Code:
path = "file:/" + path.replace(/\\/gi,"/");
var barcodeElement = document.getElementById("productBarcode");
barcodeElement.setAttribute("src", path );
barcodeElement.style.display = "inline-block";
I use the absolute path C:\path\to\java-program\data\myimage.png and build a file-URL from it.
Using this in Eclipse works without any problems. But when I build my project and start it from my jar-file the image is not shown. But the problem is not, that the path is incorrect or that generating the picture does not work, so that there is some kind of "not found" error. The place where the image should be is just white with a light border around.
And now the strangest part: If you right click on the image and choose "open in new window" the image is shown!
Does someone has an idea about that?
Thank you very much in advance!
My understanding is that the WebView won't let a page loaded with one protocol access files using another one. This makes perfect sense when you load through http://, and forbid file://. Here, you're loading through jar:file:..., and the webview will only let you access jar:file:... resources (I just tried, I can access an image from another jar file, from the same jar file, but not from outside!).
This sounds very much like a bug to me.
One workaround mentioned here is to use "data:" URI (i.e. encode the image directly in the HTML file).

Launch image displaying after deleteing

I deleted launch image from launch image option.Still i am getting launch image?I do not know where it is from loading?
You should change the name of your image as would be defaultly saved as Default.png, As xcode changes the name of the image itself whether you add the name of the image yourself or not.
And as The Dude suggested clean your code and reset your simulator if you are working on it and build your project again , then run and see.