npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nxrocks/nx-flutter

v9.3.1

Published

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

Downloads

7,961

Readme

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 :

| Arguments | Description | | ----------------- | ------------------------------------- | | <output-folder> | The folder that will contain your app |

| Option | Value | Description | | ----------------- | -------------------------------------------------------------- | -------------------------------------------------------------------------------------------- | | org | string | Name of the package | | description | string | Description of the project | | androidLanguage | java | kotlin | Language to use for Android code | | iOSLanguage | objc | swift | Language to use for iOS code | | template | app | module | package | plugin | Template of Flutter project to generate | | sample | string | Sample ID of the desired sample from the API documentation website (http://docs.flutter.dev) | | platforms | android | ios | linux | macos | windows | web | Platforms supported by the project to generate | | pub | boolean | Whether to run "flutter pub get" after the project has been created | | offline | boolean | Whether or not to run 'flutter pub get' in offline mode | | tags | string | Tags to use for linting (comma-separated) | | directory | string | Directory 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:

| Executor | Arguments | Description | | ------------------- | --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ | | analyze | see flutter help analyze | Analyze the project's Dart code | | assemble | see flutter help assemble | Assemble and build Flutter resources | | attach | see flutter help attach | Attach to a running app | | build-aar | see flutter help build aar | Build a repository containing an AAR and a POM file | | build-apk | see flutter help build apk | Build an Android APK file from your app | | build-appbundle | see flutter help build appbundle | Build an Android App Bundle file from your app | | build-bundle | see flutter help build bundle | Build the Flutter assets directory from your app | | build-ios | see flutter help build ios | Build an iOS application bundle (Mac OS X host only) | | buildIosframework | see flutter help build ios-framework | Produces a .framework directory for a Flutter module and its plugins for integration into existing, plain Xcode projects | | build-ipa | see flutter help build ipa | Build an iOS archive bundle (Mac OS X host only) | | clean | see flutter help clean | Delete the build/ and dart_tool/ directories | | drive | see flutter help drive | Run integration tests for the project on an attached device or emulator | | format | see dart help format | Format one or more Dart files | | gen-l10n | see flutter help gen-l10n | Generate localizations for the current project | | install | see flutter help install | Install a Flutter app on an attached device | | run | see flutter help run | Run your Flutter app on an attached device | | screenshot | see flutter help screenshot | Take a screenshot from a connected device | | symbolize | see flutter help symbolize | Symbolize a stack trace from an AOT-compiled Flutter app | | test | see flutter help test | Run Flutter unit tests for the current project | | pub-get | see flutter help pub get | Fetches and installs the dependencies listed in your pubspec.yaml file. | | pub-upgrade | see flutter help pub upgrade | Upgrades dependencies to the latest versions that match the constraints in pubspec.yaml. | | pub-downgrade | see flutter help pub downgrade | Downgrades dependencies to the earliest versions that match the constraints in pubspec.yaml. | | pub-outdated | see flutter help pub outdated | Lists outdated dependencies, showing current, upgradable, and latest versions. | | pub-add | --package=<pkg_name> (required) see flutter help pub add for the rest of options | Adds a new dependency to pubspec.yaml and fetches it. | | pub-remove | --package=<pkg_name> (required) see flutter help pub remove for the rest of options | Removes a dependency from pubspec.yaml and updates the package list. | | pub-run | --executable="<executable>" (required) see flutter help pub run for the rest of options | Runs an executable from one of your dependencies. | | pub-publish | see flutter help pub publish | Publishes your package to the Dart package repository (pub.dev). | | pub-deps | see flutter help pub deps | Displays a dependency graph of your package's dependencies. | | pub-version | see flutter help pub version | Shows the current version of the Dart SDK. |

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 addtional arguments accepted by each executor, are the same as the original flutter command they are based upon, and can be provided directly like in --option=value. Read this guide for more about the syntax to pass arguments along.

For example:

$ flutter gen-l10n --header "/// my header"
$ flutter pub add builder_runner
$ flutter pub run build_runner build

become 👉🏾

$ nx gen-l10n your-flutterapp --header="/// my header"
$ nx pub-add your-flutterapp --package=build_runner
$ nx pub-run your-flutterapp --executable="build_runner build"    // note  the "" around the executable command, because it has spaces

or

$ nx run your-flutterapp:gen-l10n --header="/// my header"
$ nx run your-flutterapp:pub-add --package=build_runner
$ nx run your-flutterapp:pub-run --executabe="build_runner build"  // note  the "" around the executable command, because it has spaces

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 Version | Nx 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)