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
Flows
auth_flowflai add auth_flowLogin, register, forgot password, verification, reset (6 screens)
onboarding_flowflai add onboarding_flowSplash, naming, multi-select pills, reveal animation
chat_experienceflai add chat_experienceComposer with voice, model selector, attachments, ghost mode
sidebar_navflai add sidebar_navDrawer, conversation list with grouping, settings sheet
app_scaffoldflai add app_scaffoldComplete app shell (installs all above + generates main.dart)

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: lib/flai       # Where FlAI files live
theme: dark                # Theme preset (dark, light, ios, premium)
app_name: My App           # Application display name
assistant_name: Assistant  # AI assistant display name
installed:                 # Installed components (auto-managed)
  - flai_init
  - auth_flow
  - app_scaffold

The CLI reads this file to place components, generate main.dart with your branding, and track installed bricks.

Connect a Backend

After installing app_scaffold, connect to a production backend:

flai connect cmmd     # Rewrites main.dart with CMMD providers

This generates provider implementations and rewrites main.dart to use real authentication, AI streaming, conversation persistence, and voice — zero manual wiring.

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