Coder Social home page Coder Social logo

fluttergen / flutter_gen Goto Github PK

View Code? Open in Web Editor NEW
1.4K 17.0 141.0 4.74 MB

The Flutter code generator for your assets, fonts, colors, … — Get rid of all String-based APIs.

Home Page: https://pub.dev/packages/flutter_gen

License: MIT License

Dart 99.59% Shell 0.24% JavaScript 0.17%
dart flutter code-generator templates assets fonts swiftgen fluttergen

flutter_gen's People

Contributors

abhishekdoshi26 avatar alexv525 avatar b4tchkn avatar blaugold avatar bramp avatar cu-toof avatar darwin-morocho avatar davidmigloz avatar dependabot[bot] avatar devilbuddy avatar drstranges avatar eoeefosa avatar felix-barz-brickmakers avatar icodelifee avatar jetpeter avatar jfacoustic avatar jinaiyuanbaojie avatar kaptnkoala avatar lcdsmao avatar mj-hd avatar mym0404 avatar nekocode avatar orevial avatar renovate[bot] avatar rotorgames avatar shatanikmahanty avatar tuanvugoodmoney avatar wasabeef avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter_gen's Issues

Select only some folders to generate assets

Is it possible to select only some folders and not all from assets/?

with this I mean overriding the default

flutter:
  assets:
    - ...

and tell flutter_gen to generate the assets only of some directories

[Feature Request] Handling duplicate file names

Sometimes it happens that for compatibility I need to use .png and .svg file with the same name e.g. splash.svg and splash.png.

It would be awesome to automatically generate different field names for these files e.g. splash_svg and splash_png.

Null safety support for generated files

When I run the generator against a project with sdk constraints set to a version with nullability on (>=2.12-0-0) I expect that the generated code is compatible with the null safety features. It is not at the moment.

I created a bash script workaround that will add the @dart=2.10 comment on top.

#!/bin/bash

fluttergen

sed -i '' '1 s/^/\/\/@dart=2.10\n/' lib/core/assets/assets.gen.dart

I currently don't have time to submit a PR with updated functionality, but if someone else is struggling with this, they can use the workaround until a compatible version is released.

Support numbers only file names

[SEVERE] 
Could not format because the source could not be parsed:

line 105, column 25 of .: Methods must have an explicit list of parameters.
    ╷
105 │   AssetGenImage get 460 => const AssetGenImage('assets/images/placeholders/460.jpg');

A current workaround would be to rename all the files to e.g. p_460.jpg

Error: Method not found: '$checkedCreate'

On running the build runner command I am getting these errors.

Screenshot (138)

My dev dependencies are:

dev_dependencies:
  flutter_test:
    sdk: flutter
  build_runner: ^2.1.4
  flutter_gen_runner: ^4.0.0
  lint: ^1.7.2
  import_sorter: ^4.6.0

Flutter doctor result:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.5.3, on Microsoft Windows [Version 10.0.19043.1288], locale en-IN)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
[√] Android Studio (version 2020.3)
[√] VS Code (version 1.61.1)

Commands tried:

flutter clean
flutter pub get
flutter pub global activate flutter_gen
flutter pub run build_runner build --delete-conflicting-outputs

flutter pub global activate flutter_gen

Package flutter_gen is currently active at version 4.0.0.
Resolving dependencies...
The package flutter_gen is already activated at newest available version.
To recompile executables, first run `global deactivate flutter_gen`.
Installed executable fluttergen.
Activated flutter_gen 4.0.0.

Flame integration

FlutterGen is wonderfull, but I do not know how to use it with Flame. Flame already assumes that images are in assets/images/. When loading an image image.load('filename.png') is used without the path. FlutterGen generates the whole path. I guess I could always remove assets/images/ from the string before using it, but it does not feel right. Flame also has assets/audio/. Will there be support for audio, too, sometime in the future?

3.1.0 Package implementation breaks app usage.

In the latest version application assets are pathed through a package directory that does not exists. This can be observed in the example project.

SvgPicture svg({
    Key? key,
    bool matchTextDirection = false,
    AssetBundle? bundle,
    String? package = 'example',
...

In this case the example package does not exist in the example project so the following excepion occurs.

======== Exception caught by image resource service ================================================
The following assertion was thrown resolving an image codec:
Unable to load asset: packages/example/assets/images/chip1.jpg

When the exception was thrown, this was the stack: 
#0      PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:227:7)
<asynchronous suspension>
#1      AssetBundleImageProvider._loadAsync (package:flutter/src/painting/image_provider.dart:667:14)
<asynchronous suspension>
Image provider: AssetGenImage(bundle: null, name: "packages/example/assets/images/chip1.jpg")
Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#732c2(), name: "packages/example/assets/images/chip1.jpg", scale: 1.0)

The only way to fix this is to manually set package to null in asset widget:
Assets.images.icons.fuchsia.svg(package: null)

Is there a way to blanket disable the package name in version 3.1.0 for all assets?

2.0 still incompatible with intl_translation

I've tried running FlutterGen with any version and ^2.0.0 version, but I still have conflict with intl_translation

Because flutter_gen_runner >=2.0.0 depends on flutter_gen_core ^2.0.0 which depends on dart_style ^1.3.12, flutter_gen_runner >=2.0.0 requires dart_style ^1.3.12.

Because dart_style >=1.3.13 requires SDK version >=2.11.99 <3.0.0 and dart_style >=1.3.11 <1.3.13 depends on analyzer ^0.41.1, dart_style >=1.3.11 requires analyzer ^0.41.1.

(1) Thus, flutter_gen_runner >=2.0.0 requires analyzer ^0.41.1.

Because intl_translation >=0.17.8 <=0.17.10 depends on analyzer >=0.36.0 <0.40.0 and no versions of intl_translation match >0.17.10+1 <0.18.0, intl_translation >=0.17.8 <0.17.10+1 or >0.17.10+1 <0.18.0 requires analyzer >=0.36.0 <0.40.0.

And because intl_translation 0.17.10+1 depends on analyzer ^0.39.12, intl_translation ^0.17.8 requires analyzer >=0.36.0 <0.40.0.

And because flutter_gen_runner >=2.0.0 requires analyzer ^0.41.1 (1), flutter_gen_runner >=2.0.0 is incompatible with intl_translation ^0.17.8.

So, because DemoProject depends on both intl_translation ^0.17.10 and flutter_gen_runner ^2.0.0, version solving failed.

Any idea how to make it work? Thank you!

Support path method to an asset folder

For example I have the next settings:

# pubspec.yaml
flutter:
  assets:
    - assets/images/profile.jpg

And the library generates path to the profile image.

Widget build(BuildContext context) {
  // Assets.images.profile.path = 'assets/images/profile.jpg'
  return Image.asset(Assets.images.profile.path);
}

But sometime I need to write a specific code and have access to the folder assets/images. Could you support the logic?

var imagesPath = Assets.images.path;
// do some magic in the folder

[Feature Request] Expose config for excluding gen files

I've been generating the assets and got surprised by unexpected records. Well, its kinda expected (the file exists there), but would be great to ignore these, as I don't treat .DS_Store as my project files :)

...
String get dSStore => 'animations/.DS_Store';
...

Any chance to expose exclude config (similar to the one we have in analasis_options.yaml) or at least ignore some well known files by default? <3

Requires parameters to exclude directories.

Please consider the following use-case:

assets/images/... -> should be generated
assets/data/... -> should not be generated

All files inside the data folder are simple data files, for example json or xml files. Which are used internally in the flutter application and therefore should not be considered as layout files (images, color, fonts etc.).

It would be great to have an exclude: property to defines those files or directories.

Originally posted by @jayjah in #132 (comment)

Resolution-aware image assets not generated

Create the folders for:
- assets/images/1x/
- assets/images/2x/
- assets/images/3x/

Code for the assets in this folders are not generated.

Question: How does flutter gen handle images for different resolutions? This could be done automatically.

Conflict with `json_serializable` related to `analyzer`

I've tried to use json_serializable in the latest version 5.0.0 together with flutter_gen, and after adding both to pubspec.yaml, I'm receiving following error:

Because flutter_gen_core 3.1.1 depends on analyzer ^1.0.0 and no versions of flutter_gen_core match >3.1.1 <4.0.0, flutter_gen_core ^3.1.1 requires analyzer ^1.0.0.
And because json_serializable 5.0.0 depends on analyzer ^2.0.0 and flutter_gen_runner 3.1.1 depends on flutter_gen_core ^3.1.1, json_serializable 5.0.0 is incompatible with flutter_gen_runner 3.1.1.
So, because app depends on both flutter_gen_runner 3.1.1 and json_serializable 5.0.0, version solving failed.
pub get failed (1; So, because app depends on both flutter_gen_runner 3.1.1 and json_serializable 5.0.0, version solving failed.)

I thought that this can be solved with a simple override of conflicting analyzer dependency so I added this to my pubspec.yaml:

dependency_overrides:
  analyzer: ^2.0.0 # Required by flutter_gen_core -> 1.0.0

After this, pub get finishes without error, but any attempt to run flutter pub run build_runner build ends up with null-safety errors (after flutter_gen phase is finished) like this:

[SEVERE] json_serializable:json_serializable on lib/communication/network/model/login_response_dto.dart (cached):

Generator cannot target libraries that have not been migrated to null-safety.
package:app/communication/network/model/login_response_dto.dart:4:7
  ╷
4 │ class LoginResponseDTO {
  │       ^^^^^^^^^^^^^^^^
  ╵

and

This builder requires Dart inputs without syntax errors.
However, package:app/presentation/screen/splash/splash_screen.dart (or an existing part) contains the following errors.
splash_screen.dart:9:26: This requires the 'non-nullable' language feature to be enabled.

Try fixing the errors and re-running the build.

I've tried to resolve this for a while now, but I fail to understand if this is caused by flutter_gen or json_serializble. Any suggestion on how to approach this?

Name collision with flutter localization when using build_runner.

This package has the exact same name than the official flutter localization package, resulting in name collision.

After importing flutter_gen package (this package), my localization files are broken.
error: Target of URI doesn't exist: 'package:flutter_gen/gen_l10n/app_localizations.dart'.

Any ideas ?

EDIT
I just found that the file ".dart_tool\package_config.json" contains a ref to flutter_gen-1.2.1

    {
      "name": "flutter_gen",
      "rootUri": "../../../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/flutter_gen-1.2.1",
      "packageUri": "lib",
      "languageVersion": "2.7"
    },

And this package is currently at 1.2.1, so I guess the plugin used by Flutter is this one ? So it's the same package after all ?
But why it collides then ?

Fetature request: custom name for 'Assets' class

Hi,

Could you please add a config parameter to be able to use not default class name such as 'Asstes' but custom one?

So if custom class name is MyAssets result should be:
MyAssets.images.aaa
MyAssets.fonts.aaa

update json_annotation dependency

When I run "pub get" appears this error

Because flutter_gen >=2.0.1 <2.0.2 depends on flutter_gen_core ^2.0.1 and flutter_gen >=2.0.2 depends on flutter_gen_core ^2.0.2, flutter_gen >=2.0.1 requires flutter_gen_core ^2.0.1.
And because flutter_gen_core >=2.0.1-dev.0 depends on json_annotation ^3.1.0, flutter_gen >=2.0.1 requires json_annotation ^3.1.0.
So, because your_project depends on both json_annotation ^4.0.0 and flutter_gen ^2.0.1, version solving failed.

Can you please update the dependency?

Update to analyzer 3.0.0

I can't update freezed to 1.1.1, because flutter_gen depends on analyzer: '>=2.0.0 <3.0.0' and freezed requires analyzer: ^3.0.0

Because no versions of flutter_gen_runner match >4.1.4 <5.0.0 and flutter_gen_runner 4.1.4 depends on flutter_gen_core ^4.1.4, flutter_gen_runner ^4.1.4 requires flutter_gen_core ^4.1.4.
Because flutter_gen_core 4.1.4 depends on analyzer ^2.0.0 and no versions of flutter_gen_core match >4.1.4 <5.0.0, flutter_gen_core ^4.1.4 requires analyzer ^2.0.0.
Thus, flutter_gen_runner ^4.1.4 requires analyzer ^2.0.0.
And because freezed >=1.1.1 depends on analyzer ^3.0.0, flutter_gen_runner ^4.1.4 is incompatible with freezed >=1.1.1.
So, because customer depends on both freezed ^1.1.1 and flutter_gen_runner ^4.1.4, version solving failed.
pub get failed (1; So, because customer depends on both freezed ^1.1.1 and flutter_gen_runner ^4.1.4, version solving failed.)

Please upgrade analyzer to ^3.0.0

YAML support?

Just came across this repo, very cool.

Something we do is store content in yaml files so they are easy to edit by non developers. It would be great to have everything type safe. It looks like yaml is already a dependency for this package. Is it reasonable to add yaml files as a supported file type? One way to do it would be to convert the yaml to json first then put the resulting data into a yaml namespace using the existing json converter.

Thanks!

Question: Why use getter method?

Is there any reason causes this library has to use the getter method to get value? It makes it impossible to assign a value in some cases. For example, assigning a default value:

image

Future Request : Support other file format like flr

I notice ".flr" file used by flare_flutter is not generated.
This package is widely used to add animation to flutter apps, just like lottie from Airbnb.
version 1.2.1 by dart command-line.

Thank you very much.😀

Load ImageAsset for different module

I have a problem when load asset generated in one module and it can be accessed in another module. i have read generated file but not found to set package for assetimage

currently i using path generated image and making AssetImage from the path.

AssetImages( Assets.image.widgets.textDialogBox.textDialogBoxImage.path, package: "myPackage")

dartx version is in conflict with flutter_gen

Since the version constraints of dartx in pubspec.yaml of flutter_gen core is <1.0.0 and the current version of dartx is 1.0.0, pub get throws conflicts error

Because no versions of flutter_gen match >4.1.3 <5.0.0 and flutter_gen 4.1.3 depends on flutter_gen_core ^4.1.3, flutter_gen ^4.1.3 requires flutter_gen_core ^4.1.3.
Because flutter_gen_core 4.1.3 depends on dartx >=0.6.0 <1.0.0 and no versions of flutter_gen_core match >4.1.3 <5.0.0, flutter_gen_core ^4.1.3 requires dartx >=0.6.0 <1.0.0.
Thus, flutter_gen ^4.1.3 requires dartx >=0.6.0 <1.0.0.
So, because itorrentsearch depends on both dartx ^1.0.0 and flutter_gen ^4.1.3, version solving failed.

Support arbitrary files

Sometimes I have assets that are not on the list of supported extensions but I would still like to have strings generated for them. At the moment flutter_gen just ignores these files and generates no strings for them.

Example:

For the following snippet from pubspec.yaml:

flutter:
  assets:
    - CHANGELOG.md

I would expect to have a string generated for CHANGLELOG.md to avoid using hardcoded strings in my code to reference this asset.

Update to analyzer 2.0.0

I can't update freezed, because flutter_gen depends on analyzer: ^1.0.0 and freezed requires analyzer: ^2.0.0

Because flutter_gen_core 3.1.1 depends on analyzer ^1.0.0 and no versions of flutter_gen_core match >3.1.1 <4.0.0, flutter_gen_core ^3.1.1 requires analyzer ^1.0.0.
And because freezed >=0.14.3 depends on analyzer ^2.0.0, freezed >=0.14.3 is incompatible with flutter_gen_core ^3.1.1.
And because flutter_gen_runner 3.1.1 depends on flutter_gen_core ^3.1.1 and no versions of flutter_gen_runner match >3.1.1 <4.0.0, freezed >=0.14.3 is incompatible with flutter_gen_runner ^3.1.1.
So, because network_health depends on both flutter_gen_runner ^3.1.1 and freezed ^0.14.5, version solving failed.

Please upgarde analyzer to ^2.0.0

[Bug] & symbol in asset name breaks generator

Having a & in the name of the asset causes the build to fail.


line 222, column 27 of .: Unexpected text 'Crafts'.
    ╷
222 │           String get arts&Crafts =>  'assets/images/superpowers/Arts & Crafts.svg';
    │                           ^^^^^^
    ╵
line 222, column 26 of .: Operator declarations must be preceded by the keyword 'operator'.
    ╷
222 │           String get arts&Crafts =>  'assets/images/superpowers/Arts & Crafts.svg';
    │                          ^
    ╵
line 222, column 26 of .: Methods must have an explicit list of parameters.
    ╷
222 │           String get arts&Crafts =>  'assets/images/superpowers/Arts & Crafts.svg';
    │                          ^
    ╵
line 222, column 26 of .: A function body must be provided.
    ╷
222 │           String get arts&Crafts =>  'assets/images/superpowers/Arts & Crafts.svg';
    │                          ^
    ╵

[Feature Request] Add support for adding assets from a package

Hello! 👋

As a developer, I work on packages that need to contain assets. When that happens, those assets need to be referenced in a different way (see links below):

It'd be amazing for flutter_gen to support this use case.

If you believe this is a valid use case, I'd be more than happy to take a look and come up with a proposal / pull request.

Thank you! 💯

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

asdf
.tool-versions
  • dart 2.19.6
  • flutter 3.7.12
github-actions
.github/workflows/build.yml
  • actions/checkout v3
  • wasabeef/import-asdf-tool-versions-action v1.0.1
  • subosito/flutter-action v2
  • dart-lang/setup-dart v1
  • codecov/codecov-action v3
.github/workflows/release.yml
  • actions/checkout v3
  • wasabeef/import-asdf-tool-versions-action v1.0.1
  • subosito/flutter-action v2
  • dart-lang/setup-dart v1
  • softprops/action-gh-release v1
  • actions/upload-artifact v3
  • actions/download-artifact v3
  • peter-evans/repository-dispatch v2
nodenv
.node-version
  • node 19.4.0
npm
package.json
  • husky 8.0.3
  • lint-staged ^13.1.0
  • node-actionlint ^1.2.2
  • prettier ^2.8.3
  • prettier-plugin-packagejson ^2.4.0
  • pnpm 8.4.0
pub
packages/command/pubspec.yaml
  • flutter_gen_core 5.3.0
  • args >=2.0.0 <3.0.0
  • test >=1.16.0 <2.0.0
  • test_process >=2.0.0 <3.0.0
  • flutter_lints >=2.0.1 <3.0.0
packages/core/pubspec.yaml
  • path >=1.8.0 <2.0.0
  • yaml >=3.0.0 <4.0.0
  • mime >=1.0.0 <2.0.0
  • xml >=5.0.0 <7.0.0
  • dartx >=1.0.0 <2.0.0
  • color >=3.0.0 <4.0.0
  • collection >=1.15.0 <2.0.0
  • json_annotation >=4.4.0 <5.0.0
  • glob >=2.0.0 <3.0.0
  • dart_style >=2.0.0 <3.0.0
  • analyzer >=4.7.0 <6.0.0
  • args >=2.0.0 <3.0.0
  • pub_semver >=2.0.0 <3.0.0
  • source_span >=1.8.0 <2.0.0
  • test >=1.16.0 <2.0.0
  • flutter_lints >=2.0.1 <3.0.0
  • build_runner >=2.0.0 <3.0.0
  • json_serializable >=6.0.0 <7.0.0
  • version_gen >=1.0.1 <2.0.0
packages/runner/pubspec.yaml
  • flutter_gen_core 5.3.0
  • build >=2.0.0 <3.0.0
  • collection >=1.15.0 <2.0.0
  • crypto >=3.0.0 <4.0.0
  • glob >=2.0.0 <3.0.0
  • path >=1.8.0 <2.0.0
  • flutter_lints >=2.0.1 <3.0.0
  • build_test >=2.0.0 <3.0.0
pubspec.yaml
  • melos ^3.0.1

  • Check this box to trigger a request for Renovate to run again on this repository

Doesn't generate assets.gen.dart when there are no assets.

I have an app where I use flutter_gen for working with fonts and are no assets. It would be nice to not generate the empty Assets class in such cases. At least parameters like generate_assets, generate_fonts with true at default in the yaml file will be great.

Feature Request: Lottie files

Hey there!

Would be great to have integration for the lottie files (through https://pub.dev/packages/lottie). Right now in the project I'm working on we're using the syntax:

Lottie.asset(Assets.animations.animationName)

but would be lovely to achieve it just like for the SVG files through the generated code:

Assets.animations.animationName.lottie()

The trickiest part would be probably to distinguish lottie files from non-lottie files, as it uses .json as the file extension?

Discussion of renaming FlutterGen?

Please read this #49.

This package has exactly the same name as the official Flutter Localization package, so there is a name conflict. Therefore, the official L10n (Flutter 1.22 +) and build_runner of FlutterGen cannot be used at the same time.
*Dart CLI and Homebrew are fine.

We now have these options available.

  • Just minor change the pub.dev namespace => 😄
  • Don't support build_runner => 🎉
  • Rebranding and re-register to pub.dev (... need ideas..) => 🚀

Please vote...

[Feature Request] Autogenerate List with assets in class

We have around 50 icons in our app and we would like to autogenerate a value getter that returns a list of all the assets in the class

class $AssetsIconsGen {
  const $AssetsIconsGen();

  /// File path: assets/icons/arrow_down.svg
  SvgGenImage get arrowDown => const SvgGenImage('assets/icons/arrow_down.svg');

  /// File path: assets/icons/arrow_left.svg
  SvgGenImage get arrowLeft => const SvgGenImage('assets/icons/arrow_left.svg');

  List<SvgGenImage> get svgAssets =>  [arrowDown, arrowLeft];
}

The reason is that we have an internal design component library app that displays all the icons together

Optional Nullability

First of all, amazing tool! Use it on the daily!

Is there a way to tell the tool not to generate dart 2.12 optional fields?
Many of my projects are still on non null-sound libraries, it's quite tedious to go and delete all the ? every time the tool runs

Color Gen issue

I got stuck if I have mentioned more than one color in colors.xml file it is not updating the colors.gen.dart. Works fine if there is only one color in the file

Can't generate files when using a local library or dependency_overrides

Hey,
I created a project to test the library and whenever I'm importing a local library in my test project (either by having a reference to it or using the dependency_overrides method), I do have the following error.

The pubspec.yaml file has changed since the pubspec.lock file was generated, please run "pub get" again.
pub finished with exit code 65

Here is the how to reproduce this issue.

  1. Clone any library, font_awesome_flutter for example
  2. Create a new project with a version of Flutter 2.0.3 or 2.0.4
  3. Implement the library font_awesome_flutter in the pubspec.yaml with the relative path to the previously cloned folder
  4. Import the build_runner and flutter_gen libs
  5. Run flutter pub get and flutter pub run build_runner build --delete-conflicting-outputs

pubspec.yaml

version: 1.0.0+1

environment:
  sdk: ">=2.12.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter

  font_awesome_flutter:
    path: ../font_awesome_flutter/

  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
#  cupertino_icons: ^1.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter
  build_runner:
  flutter_gen:

And here is my flutter doctor -v

[✓] Flutter (Channel unknown, 2.0.3, on Mac OS X 10.15.6 19G2021 darwin-x64, locale en-FR)
    • Flutter version 2.0.3 at /Users/florian/fvm/versions/2.0.3
    • Framework revision 4d7946a68d (2 weeks ago), 2021-03-18 17:24:33 -0700
    • Engine revision 3459eb2436
    • Dart version 2.12.2

[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/florian/Library/Android/sdk/
    • Platform android-30, build-tools 29.0.3
    • ANDROID_HOME = /Users/florian/Library/Android/sdk/
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup for more details.

[✓] Xcode - develop for iOS and macOS
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 12.1, Build version 12A7403
    • CocoaPods version 1.10.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 3.5)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 44.0.1
    • Dart plugin version 191.8593
    • Java version OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b49-5587405)

[✓] IntelliJ IDEA Ultimate Edition (version 2019.1)
    • IntelliJ at /Applications/IntelliJ IDEA.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin version 191.6183.88

[✓] VS Code (version 1.43.0)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-x64     • Mac OS X 10.15.6 19G2021 darwin-x64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 89.0.4389.114

If I do the same thing but targeting the published package of font_awesome_flutter instead of the local one, no problem.
I may have missed a crucial information !
Thank you

Support generating const assets

Currently generated Assets like Assets.image.foo.bar is not const.
Someone may prefer to use const Widget, so it's better to add an option to generate a const version.
Example: Assets.image_foo_bar.

Run with every build?

Assuming that I have build_runner and flutter_gen_runner configured properly in my pubspec.yaml should these run with every build? Or is it only possible to build these manually using flutter packages pub run build_runner build? Thanks.

Generate constants

For example,

class $AssetsBlobLottieGen {
  const $AssetsBlobLottieGen();

  /// File path: assets/blob/lottie/bug.json
  String get bug => 'assets/blob/lottie/bug.json';
}

can be

class $AssetsBlobLottieGen {
  const $AssetsBlobLottieGen();

  /// File path: assets/blob/lottie/bug.json
  const bug = 'assets/blob/lottie/bug.json';
}

Similar holds for AssetGenImage and so on.

Then we can use that value as constant happily. For example,

      child: Image(
        image: Assets.icon.icon,
        width: 64,
        height: 64,
      ),

can be

      child: const Image( // <-- notice "const"
        image: Assets.icon.icon,
        width: 64,
        height: 64,
      ),

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.