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
I have several const that defines some static data in my app.
Before using flutter_gen, I could write something like this : const breath = MultiSelectorItem('breath', 'assets/breath.svg', 'Breath');
But when using flutter_gen, this line doesn't work anymore : const breath = MultiSelectorItem('breath', Assets.breath.path, 'Breath');
Describe the solution
It seems that it's because the generated class SvgGenImage.path is a getter, so NOT const.
class SvgGenImage {
const SvgGenImage(this._assetName);
final String _assetName;
[...]
String get path => _assetName;
String get keyName => _assetName;
}
Do you have an idea how can I use the asset path in a const ?
Additional context
I now I could remove flutter_svg: true in pubspec, but using this kind of code is also handy : child: Assets.breath.svg()
Request looks similar to #351, but it is somewhat different.
Code of Conduct
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
Is there an existing issue for this?
Describe the problem
I have several const that defines some static data in my app.
Before using
flutter_gen
, I could write something like this :const breath = MultiSelectorItem('breath', 'assets/breath.svg', 'Breath');
But when using
flutter_gen
, this line doesn't work anymore :const breath = MultiSelectorItem('breath', Assets.breath.path, 'Breath');
Describe the solution
It seems that it's because the generated class
SvgGenImage.path
is a getter, so NOT const.Do you have an idea how can I use the asset path in a const ?
Additional context
I now I could remove
flutter_svg: true
inpubspec
, but using this kind of code is also handy :child: Assets.breath.svg()
Request looks similar to #351, but it is somewhat different.
Code of Conduct
The text was updated successfully, but these errors were encountered: