/f

A simple shortcut, command line interface (CLI) for Flutter to increase productivity and happiness.

Primary LanguageDartMIT LicenseMIT

F

A simple shortcut, command line interface (CLI) for Flutter to increase productivity and happiness.

Installation

To activate f CLI from your terminal.

pub global activate f

Windows Problem

For those of you who use Windows, you might experience a "double run" problem, where some f commands will be called twice.

It's a known problem that comes with pub (and affected every CLI package in pub.dev).

The solution for this problem, for now, is to activate f locally, by first cloning the repository to your local drive.

git clone https://github.com/salkuadrat/f

Then activate it with this command.

pub global activate --source path <f-location>

As example, if you run git clone on the root of drive D, then the activate command will be...

pub global activate --source path "D:\f"

This kind of local activation will nicely handle the "double run" problem on Windows.

Create Project

Use this command to create a Flutter project:

f c myapp

It's the same as flutter create myapp.

To create Flutter project with some predefined dependencies, you can list them after the project name.

f c myapp path intl http provider

The command above will generate myapp project in myapp directory, and automatically install all the required dependencies (for this example: path, intl, http & provider).

You can also pass other arguments, like project name, organization name, or specify the programming language used for the native platform.

f c -p myapp -o dev.flutter -a kotlin -i swift myapp path intl http provider

Starter Project

Starter project is a Flutter template that you can use for your new project.

To create a starter project:

f s myapp

By default f s command will generate a starter project with Provider.

If you want starter project with other state management (BLoC, Cubit, GetX, or Riverpod), you can specify it in the f s command.

f s --bloc myapp

f s --cubit myapp

f s --getx myapp

f s --riverpod myapp

You can also pass additional arguments.

f s -p myapp -o dev.flutter -a kotlin -i swift myapp

To see the structure of starter project generated by f s command, you can explore the examples below.

starter_bloc
starter_cubit
starter_getx
starter_riverpod
starter_provider

After creating a starter project with f s, you can use f m command to generate a new module inside the project, like:

f m posts

It will auto-detect the state management in your project, and generate all the module files accordingly.

Run Project

Run your Flutter project with this command.

f r

It's the same as flutter run.

To run project as flutter run --profile:

f rp

To run project as flutter run --release:

f rr

You can add -v to the end of f command to display the complete diagnostic informations.

f r -v

Build Project

To build executable for a Flutter project, use:

f b apk

f b arr

f b appbundle

f b bundle 

f b web

To build apk with split per abi:

f bs apk

Other Commands

The complete list of f commands that you can use for Flutter.

Command Description
f a -d DEVICE_ID Analyzes the project’s Dart source code.
Alias of flutter analyze
f as -o DIRECTORY Assemble and build flutter resources.
Alias of flutter assemble
f at -d DEVICE_ID Attach to a running application.
Alias of flutter attach
f b DIRECTORY Flutter build commands.
Alias of flutter build
f bs DIRECTORY Flutter build commands with split per abi.
Alias of flutter build --split-per-abi
f ch CHANNEL_NAME List or switch flutter channels.
Alias of flutter channel
f cl Clean a flutter project.
Alias of flutter clean
f dev -d DEVICE_ID List all connected devices.
Alias of flutter devices
f doc Show information about the installed tooling.
Alias of flutter doctor
f drv Runs Flutter Driver tests for the current project.
Alias of flutter drive
f e List, launch and create emulators.
Alias of flutter emulators
f f DIRECTORY|DART_FILE Formats Flutter source code.
Alias of flutter format
f i -d DEVICE_ID Install a Flutter app on an attached device.
Alias of flutter install
f l Show log output for running Flutter apps.
Alias of flutter logs
f t [DIRECTORY|DART_FILE] Runs tests in this package.
Alias of flutter test
f up Upgrade your copy of Flutter.
Alias of flutter upgrade
f down Downgrade Flutter to the last active version for the current channel. Alias of flutter downgrade