Mobile 1,687 installs

Developing Flutter Plugins

by flutter/skills

Builds Flutter plugins that provide native interop for other apps to use. Use when creating reusable packages that bridge Flutter with platform-specific…

Skill content

Scaffold and implement cross-platform Flutter plugins with native interop for Android, iOS, Windows, and web.

- Supports both standard plugins (Method Channels for platform APIs) and FFI plugins (C/C++ native libraries); choose based on whether you need platform-specific SDK access or direct native code binding

- Federated plugin architecture splits API across app-facing, platform interface, and independent platform implementation packages for team-based development

- Includes step-by-step workflows for Android V2 embedding with lifecycle awareness, Windows C++ implementation via Visual Studio, and retrofitting existing plugins with new platforms

- Provides code examples for Android plugin structure, Gradle setup, and legacy compatibility patterns

Developing Flutter Plugins

Contents

- Architecture & Design Patterns

- Workflow: Creating a New Plugin

- Workflow: Implementing Android Platform Code

- Workflow: Implementing Windows Platform Code

- Workflow: Adding Platforms to an Existing Plugin

- Examples

Architecture & Design Patterns

Federated Plugins

Implement federated plugins to split a plugin's API across multiple packages, allowing independent teams to build platform-specific implementations. Structure federated plugins into three distinct components:

- App-facing interface: The primary package users depend on. It exports the public API.

- Platform interface: The package defining the common interface that all platform implementations must implement.

- Platform implementations: Independent packages containing platform-specific code (e.g., my_plugin_android, my_plugin_windows).