Brew Flutter

  

Latest course update now includes an entire module on Flutter State Management! Welcome to the Complete Flutter App Development Bootcamp with Dart - created in collaboration with the Google Flutter team. Covering all the fundamental concepts for Flutter development, this is the most comprehensive Flutter course available online. Brew install flutter brew cask install android-studio When installing Android Studio on macOS you may need to allow system software from “Intel Corporation Apps” and agree to Android licenses. This tutorial was verified with Flutter v1.22.2, Android SDK v30.0.2, and Android Studio v4.1. Setting Up the Project.

Brew flutter meaning

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

Inspired by SwiftGen.

Motivation #

Using asset path string directly is not safe.

Bad
What would happen if you made a typo?

⭕️ Good
We want to use it safely.

Installation #

Homebrew #

Works with MacOS and Linux.

Pub Global #

Works with MacOS, Linux and Windows.

You might need to set up your path.

As a part of build_runner #

  1. Add build_runner and FlutterGen to your package's pubspec.yaml file:
  1. Install FlutterGen
  1. Use FlutterGen

Usage #

Run fluttergen after the configuration pubspec.yaml.

Configuration file #

Brew

FlutterGen generates dart files based on the key flutter and flutter_gen of pubspec.yaml.
Default configuration can be found here.

Available Parsers #

Assets #

Brew Uninstall Flutter

Just follow the doc Adding assets and images#Specifying assets to specify assets, then FlutterGen will generate related dart files.
No other specific configuration is required.
Ignore duplicated.

Flutter

These configurations will generate assets.gen.dart under the lib/gen/ directory by default.

Usage Example

FlutterGen generates Image class if the asset is Flutter supported image format.

Format readme github

Example results of assets/images/chip.jpg:

  • Assets.images.chip is an implementation of AssetImage class.
  • Assets.images.chip.image(..) returns Image class.
  • Assets.images.chip.path just returns the path string.

Brew Flutter Meaning

If you are using SVG images with flutter_svg you can use the integration feature.

Available Integrations

PackagesFile extensionSettingUsage
flutter_svg.svgflutter_svg: trueAssets.images.icons.paint.svg()
flare_flutter.flrflare_flutter: trueAssets.flare.penguin.flare()
Flutter

<br/>

In other cases, the asset is generated as String class.

FlutterGen also support generating other style of Assets class:

Brew Flutter Box

Brew Flutter

The root directory will be omitted if it is either assets or asset.

Example of code generated by FlutterGen

Fonts #

Just follow the doc Use a custom font to specify fonts, then FlutterGen will generate related dart files.
No other specific configuration is required.
Ignore duplicated.

These configurations will generate fonts.gen.dart under the lib/gen/ directory by default.

Usage Example

Example of code generated by FlutterGen

Colors #

FlutterGen supports generating colors from XML format files.
Ignore duplicated.

Flutter Brew Contest

FlutterGen can generate a Color class based on the name attribute and the color hex value.If the element has the attribute type, then a specially color will be generated.

Currently supported special color types:

Noticed that there is no official material color generation algorithm. The implementation is based on the mcg project.

These configurations will generate colors.gen.dart under the lib/gen/ directory by default.

Usage Example

Example of code generated by FlutterGen

Default Configuration #

The following are the default settings.The options you set in pubspec.yaml will override the corresponding default options.

Credits #

Brew Flutter Recipe

The material color generation implementation is based on mcg and TinyColor.

Issues #

Please file FlutterGen specific issues, bugs, or feature requests in our issue tracker.

Plugin issues that are not specific to FlutterGen can be filed in the Flutter issue tracker.

Contributing #

We are looking for co-developers.

If you wish to contribute a change to any of the existing plugins in this repo,please review our contribution guideand open a pull request.