flutter_gen
flutter_gen copied to clipboard
Cannot generate from assets with package in its path
As stated, it seems just like ignoring it. So I have looked through related code and found a very interesting lines that I suspect cause that (without debugging it).
Looks like a function _getAssetRelativePathList
(used in every variant of case style) has only two conditions to add paths from pubspec assets, I think both of these conditions ending up with 'false' and function silently drops such paths (like it's a good way to handle this, which is surely not).
Conditions are:
FileSystemEntity.isDirectorySync / FileSystemEntity.isFileSync
https://github.com/FlutterGen/flutter_gen/blob/de64e755d9a1d72cf70f892cf4107364388bff27/packages/core/lib/generators/assets_generator.dart#L99
I was right about this, I have put these lines:
stdout.writeln('Assets:');
stdout.writeln(assets.length);
stdout.writeln(assets);
stdout.writeln('Relativized asset paths:');
stdout.writeln(assetRelativePathList.length);
stdout.writeln(assetRelativePathList);
which gives me an output:
Assets:
5
[packages/.../assets/resources/snackbar/action-close.svg, packages/.../assets/resources/snackbar/action-redirect.svg, packages/.../assets/resources/snackbar/status-info.svg, packages/.../assets/resources/snackbar/status-success.svg, packages/.../assets/resources/snackbar/status-warning.svg]
Relativized asset paths:
0
[]
@Aqluse Could you verify if #471 resolves the issue?