You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support getting an asset file path from AssetBundle #11892
Currently you can load from an AssetBundle, and get the data inside the asset. However, in some cases you need to pass the path to the actual file holding the asset data; for example if you want to play back a video using the video_launcher plugin.
@mit-mit@mravn-google I'm leaving this in the current milestone since it seems like video-related work, but please don't hesitate to move it out if it's not something you think we'll get to in the next few months.
No, but we are in the process of redesigning our asset API and the plan is to make it possible to get the path of a given asset. Is there a particular use case that you would like support for?
Posse had a similar issue where after selecting an asset from Flutter, there was no easy way to pass that asset reference to the native side without reading out the asset and shuffling all the bytes across platform channel.
I am currently working on how we handle assets on Android which will hopefully fix the slow startup, reduce the installed size and also make it possible to get a handle on an asset in the APK, which can be passed on, for instance to the video player.
Thanks Sarah,
This stuff has a huge impact on my app (a lot of images and low profile
devices). I'm really thankful to everything you're doing on this issue.
Happy to help if needed.
Arran
On Fri, 23 Feb 2018, 10:35 Sarah Zakarias, ***@***.***> wrote:
I am currently working on how we handle assets on Android which will
hopefully fix the slow startup, reduce the installed size and also make it
possible to get a handle on an asset in the APK, which can be passed on,
for instance to the video player.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#11892 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AITM9mplwC0fHp_GhdZJ1i_g74rKdtDmks5tXpRlgaJpZM4PJ8L_>
.
Hi @szakarias any updates? where are now on this? been a couple of months now...atleast we are just trying to find out progress and there's anything we can do to help as @arranf mentioned because for some os this is one of the major blocks for bring our apps live...thanks
I'm still not clear on how this was fixed. I'm trying to bundle some PDF files for displaying in my app and need the absolute path to them in order to open them. I don't see anything in AssetBundle documentation that gives me the path to them.
The original scope of this bug was to offer an asset API for getting assets paths on the host platforms. Documentation was added for Android and iOS here:
I have another use case and it is a rather simple one. Theming. I want an automatic way to get an asset path using a dark asset variation if available, otherwise using the normal path. So I need a fast, synchronous way to check for the existence of an asset without loading it. The minimum building block I need to implement this is to get the root path for assets. I can add functionality to my plugin to do this but this seems like a basic feature that should come packaged with Flutter automatically.
My use case is bundling a test video in my repo to use for a mock video picker service so i can do things like golden test thumbnail/film-strip widget that takes a file as argument. I don't see a way to achieve this without being able to get the path of an asset.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
Hixie commentedon Dec 19, 2017
@mit-mit @mravn-google I'm leaving this in the current milestone since it seems like video-related work, but please don't hesitate to move it out if it's not something you think we'll get to in the next few months.
mit-mit commentedon Dec 20, 2017
Yes, we should keep this. Should be fairly easy once the flx work completes.
sroddy commentedon Jan 15, 2018
Is there a workaround to get the root path of the asset directory other than getting it with a MethodChannel?
szakarias commentedon Jan 16, 2018
No, but we are in the process of redesigning our asset API and the plan is to make it possible to get the path of a given asset. Is there a particular use case that you would like support for?
sroddy commentedon Jan 16, 2018
No, my use case was to be able to get the absolute path of a video inside the assets in order to load it with the video player plugin
xster commentedon Jan 26, 2018
Posse had a similar issue where after selecting an asset from Flutter, there was no easy way to pass that asset reference to the native side without reading out the asset and shuffling all the bytes across platform channel.
mit-mit commentedon Jan 29, 2018
Yes, that's the same issue. We hope that @szakarias can get to this fairly soon
arranf commentedon Jan 29, 2018
I also have a use case for detecting whether an asset is a part of the bundle and if not, fetching it from a remote source.
1 remaining item
szakarias commentedon Feb 23, 2018
I am currently working on how we handle assets on Android which will hopefully fix the slow startup, reduce the installed size and also make it possible to get a handle on an asset in the APK, which can be passed on, for instance to the video player.
arranf commentedon Feb 23, 2018
MichaelSowah commentedon Feb 27, 2018
Hi @szakarias any updates? where are now on this? been a couple of months now...atleast we are just trying to find out progress and there's anything we can do to help as @arranf mentioned because for some os this is one of the major blocks for bring our apps live...thanks
szakarias commentedon Apr 6, 2018
Fixed, see the documentation.
devxpy commentedon Jul 15, 2018
I wish i had found this earlier.
leifcr commentedon Nov 3, 2018
Any possibility of accessing the data through as a normal 'File' in dart?
Example:
QB3L commentedon Feb 18, 2019
I'm still not clear on how this was fixed. I'm trying to bundle some PDF files for displaying in my app and need the absolute path to them in order to open them. I don't see anything in AssetBundle documentation that gives me the path to them.
mit-mit commentedon Feb 19, 2019
The original scope of this bug was to offer an asset API for getting assets paths on the host platforms. Documentation was added for Android and iOS here:
https://flutter.io/docs/development/ui/assets-and-images#android
https://flutter.io/docs/development/ui/assets-and-images#ios
It sounds like there is a request to have a similar API on the Dart side. That sounds reasonable, but I suggest you open a new issue for that request.
QB3L commentedon Feb 19, 2019
Thanks for the explanation @mit-mit now it's clearer. I misunderstood the scope of this completely. Will reopen another ticket
RolfHendriks commentedon Jun 13, 2019
I have another use case and it is a rather simple one. Theming. I want an automatic way to get an asset path using a dark asset variation if available, otherwise using the normal path. So I need a fast, synchronous way to check for the existence of an asset without loading it. The minimum building block I need to implement this is to get the root path for assets. I can add functionality to my plugin to do this but this seems like a basic feature that should come packaged with Flutter automatically.
lukepighetti commentedon Sep 23, 2019
My use case is bundling a test video in my repo to use for a mock video picker service so i can do things like golden test thumbnail/film-strip widget that takes a file as argument. I don't see a way to achieve this without being able to get the path of an asset.
augsun commentedon Apr 7, 2020
We hope that can get to this fairly soon, this question take me 1day to fine method.
lock commentedon Apr 25, 2020
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.