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 |
Libraries
- analyze
- assemble
- attach
- build
- channel
- clean
- create
- devices
- doctor
- downgrade
- drive
- emulators
- extension
- f
- format
- install
- logs
- module
- modules/bloc
- modules/cubit
- modules/getx
- modules/provider
- modules/riverpod
- run
- start
- starter
- templates/api
- templates/app
- templates/config
- templates/gradle
- templates/main
- templates/manifest
- templates/models
- templates/modules/auth/auth
- templates/modules/auth/auth_bloc
- templates/modules/auth/auth_cubit
- templates/modules/auth/auth_getx
- templates/modules/auth/auth_mobx
- templates/modules/auth/auth_provider
- templates/modules/auth/auth_riverpod
- templates/modules/home/home
- templates/modules/home/home_bloc
- templates/modules/home/home_cubit
- templates/modules/home/home_getx
- templates/modules/home/home_mobx
- templates/modules/home/home_provider
- templates/modules/home/home_riverpod
- templates/modules/users/users
- templates/modules/users/users_bloc
- templates/modules/users/users_cubit
- templates/modules/users/users_getx
- templates/modules/users/users_mobx
- templates/modules/users/users_provider
- templates/modules/users/users_riverpod
- templates/pubspec
- templates/routes
- templates/screens
- templates/screens/home/home
- templates/screens/home/home_bloc
- templates/screens/home/home_cubit
- templates/screens/home/home_getx
- templates/screens/home/home_mobx
- templates/screens/home/home_provider
- templates/screens/home/home_riverpod
- templates/screens/login/login
- templates/screens/login/login_bloc
- templates/screens/login/login_cubit
- templates/screens/login/login_getx
- templates/screens/login/login_mobx
- templates/screens/login/login_provider
- templates/screens/login/login_riverpod
- templates/screens/splash/splash
- templates/screens/splash/splash_bloc
- templates/screens/splash/splash_cubit
- templates/screens/splash/splash_getx
- templates/screens/splash/splash_mobx
- templates/screens/splash/splash_provider
- templates/screens/splash/splash_riverpod
- templates/screens/users/users
- templates/screens/users/users_bloc
- templates/screens/users/users_cubit
- templates/screens/users/users_getx
- templates/screens/users/users_mobx
- templates/screens/users/users_provider
- templates/screens/users/users_riverpod
- templates/templates
- templates/test
- templates/utils
- templates/widgets
- test
- upgrade