leanflutter / flutter_distributor

An all-in-one Flutter application packaging and distribution tool, providing you with a one-stop solution to meet various distribution needs.
https://distributor.leanflutter.dev/
MIT License
772 stars 106 forks source link

Add support for `flutter build` option `--dart-define-from-file=` #146

Closed arran4 closed 7 months ago

arran4 commented 9 months ago
% flutter build aar --help
....
   --dart-define-from-file=<use-define-config.json|.env>    The path of a .json or .env file containing key-value pairs that will be available as environment variables.
                                                             These can be accessed using the String.fromEnvironment, bool.fromEnvironment, and int.fromEnvironment constructors.
                                                             Multiple defines can be passed by repeating "--dart-define-from-file" multiple times.
lijy91 commented 7 months ago

Currently, it supports any args for Flutter build, please refer to this example https://github.com/leanflutter/flutter_distributor/commit/694cec2ee3a1ddbb86cac5a39ac33334d8324170

output: dist/
releases:
  - name: dev-release
    jobs:
      - name: macos-dmg
        package:
          platform: macos
          target: dmg
          build_args:
            dart-define-from-file: env.json