flutter-building-plugins
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).
FFI vs. Standard Plugins
Choose the correct plugin template based on your native interoperability requirements:
More from flutter/skills
flutter-building-layouts
Builds Flutter layouts using the constraint system and layout widgets. Use when creating or refining the UI structure of a Flutter application.
10.6Kflutter-architecting-apps
Architects a Flutter application using the recommended layered approach (UI, Logic, Data). Use when structuring a new project or refactoring for scalability.
10.4Kflutter-animating-apps
Implements animated effects, transitions, and motion in a Flutter app. Use when adding visual feedback, shared element transitions, or physics-based animations.
9.6Kflutter-managing-state
Manages application and ephemeral state in a Flutter app. Use when sharing data between widgets or handling complex UI state transitions.
9.6Kflutter-theming-apps
Customizes the visual appearance of a Flutter app using the theming system. Use when defining global styles, colors, or typography for an application.
9.5Kflutter-implementing-navigation-and-routing
Handles routing, navigation, and deep linking in a Flutter application. Use when moving between screens or setting up URL-based navigation.
9.3K