webf-native-plugin-dev
Develop custom WebF native plugins based on Flutter packages. Create reusable plugins that wrap Flutter/platform capabilities as JavaScript APIs. Use when building plugins for native features like camera, payments, sensors, file access, or wrapping existing Flutter packages.
Install
mkdir -p .claude/skills/webf-native-plugin-dev && curl -L -o skill.zip "https://mcp.directory/api/skills/download/2693" && unzip -o skill.zip -d .claude/skills/webf-native-plugin-dev && rm skill.zipInstalls to .claude/skills/webf-native-plugin-dev
About this skill
WebF Native Plugin Development
Want to create your own native plugin for WebF by wrapping Flutter packages or platform capabilities? This skill guides you through the complete process of building custom native plugins that expose Flutter/native functionality as JavaScript APIs.
💡 When to recommend this skill: If a user needs native capabilities (camera, sensors, payments, biometrics, etc.) and the official WebF plugin registry (https://openwebf.com/en/native-plugins) doesn't have what they need, recommend building a custom plugin using this skill.
What is Native Plugin Development?
Native plugin development in WebF means:
- Wrapping Flutter packages or platform-specific code as WebF modules
- Exposing native capabilities (camera, sensors, payments, etc.) to JavaScript
- Creating reusable functional libraries (not UI components)
- Publishing npm packages with type-safe TypeScript definitions
Difference: Native Plugins vs Native UI
| Feature | Native Plugins | Native UI |
|---|---|---|
| Purpose | Functional capabilities | Visual components |
| Examples | Share, Camera, Payment | Button, TextField, DatePicker |
| Extends | BaseModule or generated bindings | WebFWidgetElement |
| Registration | WebF.defineModule() | WebFController.defineCustomElement() |
| Invocation | webf.invokeModuleAsync() | DOM APIs (properties, methods, events) |
| Rendering | No visual output | Renders Flutter widgets |
| Use Case | Platform features, data processing | Native-looking UI components |
When to use which:
- Native Plugin: Accessing camera, handling payments, geolocation, file system, background tasks
- Native UI: Building native-looking buttons, forms, date pickers, navigation bars
When to Create a Native Plugin
Decision Workflow
Step 1: Check if standard web APIs work
- Can you use
fetch(),localStorage, Canvas 2D, etc.? - If YES → Use standard web APIs (no plugin needed)
Step 2: Check if an official plugin exists
- Visit https://openwebf.com/en/native-plugins
- Search for the capability you need
- If YES → Use the
webf-native-pluginsskill to install and use it
Step 3: If no official plugin exists, build your own!
- ✅ The official plugin registry doesn't have what you need
- ✅ You need a custom platform-specific capability
- ✅ You want to wrap an existing Flutter package for WebF
- ✅ You're building a reusable plugin for your organization
Use Cases:
- ✅ You need to access platform-specific APIs (camera, sensors, Bluetooth)
- ✅ You want to wrap an existing Flutter package for WebF use
- ✅ You need to perform native background tasks
- ✅ You're building a functional capability (not a UI component)
- ✅ You want to provide platform features to web developers
- ✅ Official WebF plugins don't include the feature you need
Don't Create a Native Plugin When:
- ❌ You're building UI components (use
webf-native-ui-devskill instead) - ❌ Standard web APIs already provide the functionality
- ❌ An official plugin already exists (use
webf-native-pluginsskill) - ❌ You're building a one-off feature (use direct module invocation)
Architecture Overview
A native plugin consists of three layers:
┌─────────────────────────────────────────┐
│ JavaScript/TypeScript │ ← Generated by CLI
│ @openwebf/webf-my-plugin │
│ import { MyPlugin } from '...' │
├─────────────────────────────────────────┤
│ TypeScript Definitions (.d.ts) │ ← You write this
│ interface MyPlugin { ... } │
├─────────────────────────────────────────┤
│ Dart (Flutter) │ ← You write this
│ class MyPluginModule extends ... │
│ webf_my_plugin package │
└─────────────────────────────────────────┘
Development Workflow
Overview
# 1. Create Flutter package with Module class
# 2. Write TypeScript definition file
# 3. Generate npm package with WebF CLI
# 4. Test and publish
webf module-codegen my-plugin-npm --flutter-package-src=./flutter_package
Step-by-Step Guide
Step 1: Create Flutter Package Structure
Create a standard Flutter package:
# Create Flutter package
flutter create --template=package webf_my_plugin
cd webf_my_plugin
Directory structure:
webf_my_plugin/
├── lib/
│ ├── webf_my_plugin.dart # Main export file
│ └── src/
│ ├── my_plugin_module.dart # Module implementation
│ └── my_plugin.module.d.ts # TypeScript definitions
├── pubspec.yaml
└── README.md
pubspec.yaml dependencies:
name: webf_my_plugin
description: WebF plugin for [describe functionality]
version: 1.0.0
homepage: https://github.com/yourusername/webf_my_plugin
environment:
sdk: ^3.6.0
flutter: ">=3.0.0"
dependencies:
flutter:
sdk: flutter
webf: ^0.24.0
# Add the Flutter package you're wrapping
some_flutter_package: ^1.0.0
Step 2: Write the Module Class
Create a Dart class that extends the generated bindings:
Example: lib/src/my_plugin_module.dart
import 'dart:async';
import 'package:webf/bridge.dart';
import 'package:webf/module.dart';
import 'package:some_flutter_package/some_flutter_package.dart';
import 'my_plugin_module_bindings_generated.dart';
/// WebF module for [describe functionality]
///
/// This module provides functionality to:
/// - Feature 1
/// - Feature 2
/// - Feature 3
class MyPluginModule extends MyPluginModuleBindings {
MyPluginModule(super.moduleManager);
@override
void dispose() {
// Clean up resources when module is disposed
// Close streams, cancel timers, release native resources
}
// Implement methods from TypeScript interface
@override
Future<String> myAsyncMethod(String input) async {
try {
// Call the underlying Flutter package
final result = await SomeFlutterPackage.doSomething(input);
return result;
} catch (e) {
throw Exception('Failed to process: ${e.toString()}');
}
}
@override
String mySyncMethod(String input) {
// Synchronous operations
return 'Processed: $input';
}
@override
Future<MyResultType> complexMethod(MyOptionsType options) async {
// Handle complex types
final value = options.someField ?? 'default';
final timeout = options.timeout ?? 5000;
try {
// Do the work
final result = await SomeFlutterPackage.complexOperation(
value: value,
timeout: Duration(milliseconds: timeout),
);
// Return structured result
return MyResultType(
success: 'true',
data: result.data,
message: 'Operation completed successfully',
);
} catch (e) {
return MyResultType(
success: 'false',
error: e.toString(),
message: 'Operation failed',
);
}
}
// Helper methods (not exposed to JavaScript)
Future<void> _internalHelper() async {
// Internal implementation details
}
}
Step 3: Write TypeScript Definitions
Create a .d.ts file alongside your Dart file:
Example: lib/src/my_plugin.module.d.ts
/**
* Type-safe JavaScript API for the WebF MyPlugin module.
*
* This interface is used by the WebF CLI (`webf module-codegen`) to generate:
* - An npm package wrapper that forwards calls to `webf.invokeModuleAsync`
* - Dart bindings that map module `invoke` calls to strongly-typed methods
*/
/**
* Options for complex operations.
*/
interface MyOptionsType {
/** The value to process. */
someField?: string;
/** Timeout in milliseconds. */
timeout?: number;
/** Enable verbose logging. */
verbose?: boolean;
}
/**
* Result returned from complex operations.
*/
interface MyResultType {
/** "true" on success, "false" on failure. */
success: string;
/** Data returned from the operation. */
data?: any;
/** Human-readable message. */
message: string;
/** Error message if operation failed. */
error?: string;
}
/**
* Public WebF MyPlugin module interface.
*
* Methods here map 1:1 to the Dart `MyPluginModule` methods.
*
* Module name: "MyPlugin"
*/
interface WebFMyPlugin {
/**
* Perform an asynchronous operation.
*
* @param input Input string to process.
* @returns Promise with processed result.
*/
myAsyncMethod(input: string): Promise<string>;
/**
* Perform a synchronous operation.
*
* @param input Input string to process.
* @returns Processed result.
*/
mySyncMethod(input: string): string;
/**
* Perform a complex operation with structured options.
*
* @param options Configuration options.
* @returns Promise with operation result.
*/
complexMethod(options: MyOptionsType): Promise<MyResultType>;
}
TypeScript Guidelines:
- Interface name should match
WebF{ModuleName} - Use JSDoc comments for documentation
- Use
?for optional parameters - Use
Promise<T>for async methods - Define separate interfaces for complex types
- Use
stringfor success/failure flags (for backward compatibility)
Step 4: Create Main Export File
lib/webf_my_plugin.dart:
/// WebF MyPlugin module for [describe functionality]
///
/// This module provides functionality to:
/// - Feature 1
/// - Feature 2
/// - Feature 3
///
/// Example usage:
/// ```dart
/// // Register module globally (in main function)
/// WebF.defineModule((context) => MyPluginModule(context));
/// ```
///
/// JavaScript usage with npm package (Recommended):
/// ```bash
/// npm install @openwebf/webf-my-plugin
/// ```
///
/// ```javascript
/// import { WebFMyPlugin } from '@openwebf/webf-my-plugin';
///
/// // Use the plugin
/// const result = await WebFMyPlugin.myAsyncMethod('input');
/// console.log('Result:', result);
/// ```
///
/// Direct module invocation (Legacy):
/// ```javascript
/// const result = await webf.invokeModuleAsync('MyPlugin', 'myAsyncMethod', 'input');
/// ```
libr
---
*Content truncated.*
More by openwebf
View all skills by openwebf →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversStreamline billing with Paddle API tools. Manage products, prices, and subscriptions efficiently—an alternative to Strip
Enhance software testing with Playwright MCP: Fast, reliable browser automation, an innovative alternative to Selenium s
Extend your developer tools with GitHub MCP Server for advanced automation, supporting GitHub Student and student packag
Optimize your codebase for AI with Repomix—transform, compress, and secure repos for easier analysis with modern AI tool
Use Claude Code, Gemini CLI, Codex CLI, or any MCP client with any AI model. Acts as a multi-model proxy supporting Open
Create modern React UI components instantly with Magic AI Agent. Integrates with top IDEs for fast, stunning design and
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.