Open-source Flutter tooling

Embed Flutter anywhere

Transform your Flutter application into an embeddable module for iOS, Android, React Native, React Web, and Angular — with type-safe Protocol Buffer communication.

$ dart pub add dev:flutter_embedding_cli
Live demos

See it running

Experience Flutter embedded in real web frameworks. These demos show bidirectional communication in action.

The perfect use case

Build your SDK once

Imagine you're developing an SDK with rich UI components — a payment flow, an onboarding wizard, a chat interface. Your clients build native iOS apps, Android apps, React Native apps, or web apps with React and Angular.

1
Codebase
Flutter SDK
5
Platforms
iOS, Android, RN, React, Angular
∞
Clients
No Flutter knowledge needed

Without Flutter Embedding CLI: you'd build and maintain separate codebases for each platform — native Swift/Kotlin, React Native bridges, web components. That's 5+ implementations to keep in sync.

With Flutter Embedding CLI: build your SDK once in Flutter, then generate ready-to-distribute packages for every platform. Your clients integrate it like any other native library — they don't even need to know it's Flutter inside.

Why

Stop wrestling with build configurations

The problem with add-to-app

Flutter's official "add-to-app" approach is notoriously complex and painful to set up. It requires:

  • Manual configuration of build systems
  • Managing framework dependencies across platforms
  • Writing boilerplate communication code
  • Error-prone and time-consuming setup

The solution

Flutter Embedding CLI eliminates this pain. With a single command, it generates production-ready modules with:

  • Pre-configured build setup and dependency management
  • Type-safe communication using Protocol Buffers
  • Ready-to-use example apps for immediate testing
  • Proper packaging (CocoaPods or Swift Package Manager, AAR, npm)

Why Protocol Buffers instead of Pigeon?

Feature Protocol Buffers Pigeon
iOS & Android support ✓ ✓
React Native support ✓ ✗
Web (React/Angular) support ✓ ✗
Built-in schema evolution ✓ Excellent backward compatibility Limited
Cross-platform code generation ✓ One definition, all platforms Native only

Proto files generate Dart code plus native code for all platforms: iOS (Swift), Android (Java), React Native (TypeScript), React Web (TypeScript), and Angular Web (TypeScript).

Features

Define your contract, get everything else

Describe the communication between host and Flutter in Protocol Buffers — the CLI takes care of the rest.

Define your own API

Use Protocol Buffers to define your exact communication contract. Theme switching, user data, complex objects — the possibilities are endless.

Bidirectional communication

Define services for Flutter-to-host and host-to-Flutter calls. Both directions are fully type-safe with generated code.

Auto-generated code

Write your proto once, get type-safe clients and services generated for Dart, Swift, Java, and TypeScript automatically.

Multiple views (web)

Web platforms support multiple Flutter views within the same application, each with independent communication channels.

Start parameters

Pass structured initialization data when launching Flutter. Define your StartParams message in proto — include whatever your app needs.

Ready-to-ship packages

Generates CocoaPods or a Swift package for iOS, AAR for Android, and npm packages for web — ready for distribution to your teams.

Supported platforms

One Flutter module, five targets

iOS

CocoaPods or Swift Package Manager

Android

AAR module

React Native

Cross-platform module

Web (React)

npm package

Web (Angular)

npm package

Get started

From Flutter app to embeddable module in 3 steps

STEP 1

Configure

Add flutter_embedding to your pubspec.yaml and define your proto handovers for type-safe communication.

STEP 2

Generate

Run a single CLI command to generate modules for your target platforms with example apps.

STEP 3

Integrate

Import the generated package into your host application and start communicating with Flutter.

Terminal
# Install the CLI
dart pub add dev:flutter_embedding_cli

# Generate iOS module with example app
dart run flutter_embedding_cli:generate ios --example

# Generate Android module with example app
dart run flutter_embedding_cli:generate android --example

# Generate React Native module with example app
dart run flutter_embedding_cli:generate react-native --example

# Generate React web module with example app
dart run flutter_embedding_cli:generate web-react --example

# Generate Angular web module with example app
dart run flutter_embedding_cli:generate web-angular --example
handovers_to_flutter.proto
// Define what the host can call on Flutter
service HandoversToFlutter {
  rpc SetTheme(ThemeRequest) returns (Empty);
  rpc UpdateUser(UserData) returns (Empty);
  rpc NavigateTo(Route) returns (Empty);
}

message StartParams {
  string environment = 1;
  string auth_token = 2;
  UserData user = 3;
}
handovers_to_host.proto
// Define what Flutter can call on the host
service HandoversToHost {
  rpc Exit(Empty) returns (Empty);
  rpc ShareContent(ShareRequest) returns (Empty);
  rpc GetDeviceInfo(Empty) returns (DeviceInfo);
  rpc OpenPayment(PaymentRequest) returns (PaymentResult);
}

// Define any message types you need
message PaymentRequest {
  string product_id = 1;
  int32 amount = 2;
}

Define your services and messages in proto files — the CLI generates type-safe code for all platforms automatically.

iOS packaging

CocoaPods or Swift Package Manager

By default the iOS SDK is packaged for CocoaPods: podspecs plus a podhelper that link the Debug frameworks in Debug builds and the Release frameworks in Release builds of the host app.

Host team moved on from CocoaPods? Set package_manager: swift_package_manager and the CLI generates a local Swift package wrapping all Flutter xcframeworks instead — and the example app becomes a plain Xcode project that references that package. No Podfile, no pod install: add the package, build, done.

Swift Package Manager cannot switch frameworks per build configuration, so the package ships hybrid XCFrameworks: the device slice is the Release (AOT) build and the simulator slice is the Debug (JIT) build. Physical devices always run at full speed and simulators stay debuggable, whatever the host app's build configuration.

pubspec.yaml
flutter_embedding:
  ios:
    # cocoapods (default) or swift_package_manager
    package_manager: swift_package_manager
Ready when you are

Embed Flutter in your next project

Open source, MIT licensed, and shipped with example apps for every platform. Questions or ideas? Issues and PRs are welcome.