Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/salkuadrat/f

A simple shortcut, command line interface (CLI) for Flutter to increase productivity and happiness.
https://github.com/salkuadrat/f

cli dart flutter

Last synced: 3 months ago
JSON representation

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

Lists

README

        

# F

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

## Installation

To activate f CLI from your terminal.

```bash
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](https://github.com/dart-lang/pub/issues/2934) 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.

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

Then activate it with this command.

```bash
pub global activate --source path
```

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

```bash
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:

```bash
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.

```bash
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.

```bash
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:

```bash
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.

```bash
f s --bloc myapp

f s --cubit myapp

f s --getx myapp

f s --riverpod myapp
```

You can also pass additional arguments.

```bash
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_bloc)\
[starter_cubit](starter_cubit)\
[starter_getx](starter_getx)\
[starter_riverpod](starter_riverpod)\
[starter_provider](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:

```bash
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.

```bash
f r
```

It's the same as `flutter run`.

To run project as `flutter run --profile`:

```bash
f rp
```

To run project as `flutter run --release`:

```bash
f rr
```

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

```bash
f r -v
```

## Build Project

To build executable for a Flutter project, use:

```bash
f b apk

f b arr

f b appbundle

f b bundle

f b web
```

To build apk with split per abi:

```bash
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