-
Notifications
You must be signed in to change notification settings - Fork 68
[native_assets_cli] Improve documentation on asset paths #188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Quote from #946 :
The term Also, I ran out of ideas how to search for non-code asset paths - especially in the context of native (C/C++) code - as Google strongly biased for results with shared libraries and their likes. My problem is that I cannot figure out the relative path to load a DNN model in C/ffi. Abs path works |
Hi @andzsinszan, nice to meet you! Are you talking about assets from build hooks? Or assets from the pubspec in Flutter? |
Nice to meet you @dcharkes ,
I use pubspec. But probably that is the problem?
It lands in the build dir. So far so good.
During dev (linux target) I can only load the model if I use an abs path. The model loading takes place in C, path is a |
Yes, the assets reported by build hooks are not connected at all to the assets from the pubspec at this point. The assets from a Flutter pubspec are only available to Dart code as bytes or strings, they are not available as a file path. Most likely the data assets from the build hooks, once they are implemented, will also not be available as a file path. (They might be bundled inside a zip file in an app bundle and not actually be on disk.) |
I've written some ideas on if we could make the file paths for data assets from build hooks available in the future: For your current setup, you probably need to read your asset bytes (https://docs.flutter.dev/ui/assets/assets-and-images#loading-assets) and then write them to a File manually (https://api.dart.dev/stable/3.4.1/dart-io/File/writeAsBytes.html) and pass the path of that file to your C function. P.S. Feel free to open new issues instead of reviving closed ones. |
Hi @dcharkes , Many thank, you just saved me from hours of frustration.
Great clarification. Explicitly stating what cannot be done is sometimes just as useful as the valid use cases.
Very clear, thank you, will try.
Thanks, will do - though trying not to spam the issue tracker. |
Just a quick feedback - hopefully not seen as spam.
Thanks @dcharkes |
charStart.asTypedList().setRange(0, lstView.length, lstView); |
thanks, all set.
|
The documentation on asset paths is not clear on what context these asset paths refer to.
build.dart
has been run. These are modified by flutter_tools and dart_dev upon copying assets to the app bundle.We need some vocabulary to talk about these different phases.
Thanks @mkustermann for reporting!
The text was updated successfully, but these errors were encountered: