9.0.1 • Published 29 days ago

@nxrocks/nx-flutter v9.0.1

Weekly downloads
33
License
MIT
Repository
github
Last release
29 days ago

nx-flutter

npm version flutter version github action - release semantic-release

Nx Plugin adding first class support for Flutter in your Nx workspace

Contents

Features

Here is a list of some of the coolest features of the plugin:

  • ✅ Generation of Flutter applications/packages/modules/plugins based on Flutter cli API
  • ✅ Building, packaging, testing, etc your Flutter projects
  • ✅ Integration with Nx's dependency graph (through nx dep-graph or nx affected:dep-graph): this allows you to visualize the dependencies of any Flutter projects inside your workspace, just like Nx natively does it for JS/TS-based projects!

    Nx Flutter dependency graph Example of running the nx dep-graph command on a workspace with 2 Flutter projects inside

  • ...

Setup

You can now use our own create-nx-flutter CLI to easily create a Nx workspace, that comes with this plugin pre-installed!

Simply run:

# npm
npx create-nx-flutter@latest
# or
# yarn
yarn create nx-flutter

and you are good to go‧o‧o‧o! 🚀

More information here: create-nx-flutter

Otherwise, this is the traditional way of setting things up:

1. Creating the Nx workspace

This plugin relies on flutter's command-line to do its job. So, you must have flutter installed on your system. If not, head to flutter.dev/docs/get-started/install and follow installation instructions for your OS.

Then, if you have not already, create an Nx workspace with the following:

# npm
npx create-nx-workspace@latest

# yarn
yarn create nx-workspace@latest

2. Installing the Plugin

Then you need to install the plugin in order to generate Flutter applications later on.

# npm
npm install @nxrocks/nx-flutter --save-dev

# yarn
yarn add @nxrocks/nx-flutter --dev

Generators

This plugin is composed of 1 main generator:

  • project generator

Generating Projects (project generator)

Simply run the project generator with the following command:

nx g @nxrocks/nx-flutter:project <app-folder>

you can also use the following aliases to call the generator: prj, new, or create

You will be prompted for entering the most commonly customized generation options (like application's package, description, template, etc).

To skip the interactive prompt, or if you want to customize all non-prompted options, you can pass them along directly when running the command, as such:

nx g @nxrocks/nx-flutter:project <app-folder> --optionName1 optionValue1 ... --optionNameN optionValueN

Generation Options

Here the list of available generation options :

ArgumentsDescription
<output-folder>The folder that will contain your app
OptionValueDescription
orgstringName of the package
descriptionstringDescription of the project
androidLanguagejava | kotlinLanguage to use for Android code
iOSLanguageobjc | swiftLanguage to use for iOS code
templateapp | module | package | pluginTemplate of Flutter project to generate
samplestringSample ID of the desired sample from the API documentation website (http://docs.flutter.dev)
platformsandroid | ios | linux | macos | windows | webPlatforms supported by the project to generate
pubbooleanWhether to run "flutter pub get" after the project has been created
offlinebooleanWhether or not to run 'flutter pub get' in offline mode
tagsstringTags to use for linting (comma-separated)
directorystringDirectory where the project is placed

Executors

Once your app is generated, you can now use executors to manage it.

Here the list of available executors1:

ExecutorArgumentsDescription
analyzesee flutter help analyzeAnalyze the project's Dart code
assemblesee flutter help assembleAssemble and build Flutter resources
attachsee flutter help attachAttach to a running app
build-aarsee flutter help build aarBuild a repository containing an AAR and a POM file
build-apksee flutter help build apkBuild an Android APK file from your app
build-appbundlesee flutter help build appbundleBuild an Android App Bundle file from your app
build-bundlesee flutter help build bundleBuild the Flutter assets directory from your app
build-iossee flutter help build iosBuild an iOS application bundle (Mac OS X host only)
buildIosframeworksee flutter help build ios-frameworkProduces a .framework directory for a Flutter module and its plugins for integration into existing, plain Xcode projects
build-ipasee flutter help build ipaBuild an iOS archive bundle (Mac OS X host only)
cleansee flutter help cleanDelete the build/ and dart_tool/ directories
drivesee flutter help driveRun integration tests for the project on an attached device or emulator
formatsee dart help formatFormat one or more Dart files
gen-l10nsee flutter help gen-l10nGenerate localizations for the current project
installsee flutter help installInstall a Flutter app on an attached device
runsee flutter help runRun your Flutter app on an attached device
screenshotsee flutter help screenshotTake a screenshot from a connected device
symbolizesee flutter help symbolizeSymbolize a stack trace from an AOT-compiled Flutter app
testsee flutter help testRun Flutter unit tests for the current project
doctorsee flutter help doctorRun Flutter doctor to check the environment and status of Flutter installation

1 : Actual executors in your workspace.json will depend on the type of flutter project (template), target platforms that you choose to generate.

Each executor is based on an original project-level flutter command. The name is just kebab-cased to match executors' naming conventions. Besides, the arguments accepted by each executor, are the same as the original flutter command they are based upon, encapsulated under a generic --args='...' option.

For example:

$ flutter gen-l10n --header "/// my header"

becomes 👉🏾

$ nx gen-l10n your-flutterapp --args='--header="/// my header"'

Note that the original flutter command name (gen-l10n) has been camelcased for creating its nx-flutter equivalent (gen-l10n)

Note that the arguments of the original flutter command are wrapped under --args='...' option in the nx-flutter equivalent

Compatibility with Nx

Every Nx plugin relies on the underlying Nx Workspace/DevKit it runs on. This table provides the compatibility matrix between major versions of Nx workspace and this plugin.

Plugin VersionNx Workspace version
>=v9.x.x>=v18.x.x
>=v8.x.x>=v17.x.x
>=v7.x.x>=v16.x.x
>=v6.x.x>=v15.8.x
>=v5.x.x>=v15.x.x
>=v3.1.x>=v13.8.x
>=v3.x.x>=v12.6.x
>=v2.x.x>=v11.x.x
<=v1.3.1<=v10.x.x

License

Copyright (c) 2020-present Tine Kondo. Licensed under the MIT License (MIT)

9.0.1

29 days ago

9.0.0

1 month ago

0.0.0-e2e

1 month ago

8.1.0

5 months ago

8.2.0

2 months ago

7.1.0

7 months ago

8.0.1

6 months ago

8.0.0

6 months ago

8.0.2

5 months ago

6.0.1

12 months ago

7.0.0

12 months ago

7.0.3

12 months ago

7.0.2

12 months ago

7.0.1

12 months ago

5.3.0

1 year ago

6.0.0

1 year ago

5.2.1

1 year ago

5.2.0

1 year ago

5.1.0

1 year ago

5.0.0

2 years ago

4.0.1

2 years ago

4.0.0

2 years ago

4.0.2

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago

3.0.0

3 years ago

2.1.0

3 years ago

1.4.0-beta.1

3 years ago

2.0.0-beta.1

3 years ago

2.0.0

3 years ago

0.0.0

3 years ago

1.3.1

3 years ago

1.3.0

3 years ago

1.2.1

3 years ago

1.2.0

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago