Installation

Install the FlAI CLI and add components to your Flutter project. Two approaches: CLI (recommended) or manual.

CLI Installation

The FlAI CLI is the recommended way to install components. It handles dependencies, file placement, and import resolution.

Install the CLI

$ dart pub global activate flai_cli
Make sure ~/.pub-cache/bin is in your PATH. Run dart pub global list to verify the installation.

Initialize Your Project

Run flai init in your Flutter project root. This installs the core theme system, data models, and provider interface.

$ flai init

The CLI will ask you for an output directory (default: flai). Files are placed under lib/{output_dir}/.

Add Components

Install individual components with flai add:

# Add a single component
flai add message_bubble

# Add multiple components
flai add chat_screen input_bar streaming_text

# Add a provider
flai add openai_provider

Available Components

ComponentCommandDescription
chat_screenflai add chat_screenFull-page chat screen
message_bubbleflai add message_bubbleChat message bubble
input_barflai add input_barChat input with send button
streaming_textflai add streaming_textReal-time streaming text
typing_indicatorflai add typing_indicatorAI typing animation
tool_call_cardflai add tool_call_cardTool/function call card
code_blockflai add code_blockSyntax-highlighted code
thinking_indicatorflai add thinking_indicatorAI thinking panel
citation_cardflai add citation_cardSource citation card
image_previewflai add image_previewImage preview with expand
conversation_listflai add conversation_listConversation history list
model_selectorflai add model_selectorAI model dropdown
token_usageflai add token_usageToken usage display
openai_providerflai add openai_providerOpenAI API provider
anthropic_providerflai add anthropic_providerAnthropic API provider

Manual Installation

If you prefer not to use the CLI, you can copy component files directly from the FlAI repository.

Clone the repository

git clone https://github.com/getflai-dev/flai.git

Copy core files

Copy bricks/flai_init/__brick__/lib/flai/ into your project's lib/flai/ directory.

Copy components

Copy individual component folders from bricks/{component}/__brick__/lib/flai/components/ into lib/flai/components/.

Update imports

Adjust import paths to match your project's package name and directory structure.

Configuration

After running flai init, a flai.yaml file is created in your project root:

# flai.yaml
output_dir: flai          # Where FlAI files live under lib/
components:               # Installed components (auto-managed)
  - chat_screen
  - message_bubble
  - input_bar
  - typing_indicator

The CLI reads this file to know where to place new components and which components are already installed.

You can change output_dir during flai init. For example, use ui/chat to install under lib/ui/chat/.