3
I need to know which ones Assets I uploaded it to an flutter, to reflect and make a decision.
I know I can list which ones Assets that I wish to climb into the app through the pubspec.yaml
:
...
flutter:
assets:
- assets/image.png
- scripts/
...
In the above case, I’m saying I want to deliver the file on the way assets/image.png
and also all files within the directory scripts/
.
I can carry one Asset through the AssetBundle
(like the rootBundle
, already created a priori in Flutter).
For example, I can load the Asset scripts/V1.0__baseline.sql
thus:
...
// import 'dart:async' show Future;
// import 'package:flutter/services.dart' show rootBundle;
Future<String> loadAsset() async {
return await rootBundle.loadString('scripts/V1.0__baseline.sql');
}
However, I couldn’t find anything in the documentation that would allow me to list the files inside the folder scripts
to then be able to do something with them.
If that’s not possible, I’ll accept workarounds, how to generate a file with the folder listing scripts
and add it as a Asset (solution similar to what I did to solve a analogous problem in Totalcross) through some configuration in the pubspec.yaml
with any possible script call (bash
/PowerShell
/cmd
/dart
).
Didn’t the answer help you? What was missing?
– Julio Henrique Bitencourt
@Juliohenriquebitencourt timely to test, since I achieved a workaround that widely makes this difficulty "overcome" (in a silly way and not flutter to be). So until the delivery is complete I don’t think I can test
– Jefferson Quesado