developing-genkit-dart
Build AI applications with Genkit Dart SDK
Integrating AI models into Dart and Flutter applications requires understanding Genkit flows, tools, and plugins. This skill provides comprehensive reference documentation and code examples for the Genkit Dart SDK.
Download the skill ZIP
Upload in Claude
Go to Settings → Capabilities → Skills → Upload skill
Toggle on and start using
Test it
Using "developing-genkit-dart". Initialize Genkit with the Anthropic plugin and generate text using Claude.
Expected outcome:
A Dart main function that imports genkit and genkit_anthropic, reads ANTHROPIC_API_KEY from Platform.environment, creates a Genkit instance with the anthropic plugin, and calls ai.generate with the claude-sonnet-4-5 model.
Using "developing-genkit-dart". Define a remote action client that calls a flow running on localhost.
Expected outcome:
Dart code using defineRemoteAction with a localhost URL, showing both non-streaming and streaming invocation patterns with type-safe input and output schemas.
Using "developing-genkit-dart". Set up a Shelf HTTP server to serve Genkit flows.
Expected outcome:
A Dart main function that imports genkit_shelf, defines a simple flow, and starts an HTTP server on port 8080 using startFlowServer.
Security Audit
SafeThis skill is a documentation and reference guide from the official Firebase agent-skills repository. It contains 11 markdown files with Dart code examples for the Genkit Dart SDK. The static analyzer reported 202 potential issues, but all are false positives. The primary detection was markdown code fences (```) misinterpreted as Ruby/shell backtick execution. Environment variable references in examples follow secure patterns (reading from Platform.environment rather than hardcoding credentials). Localhost URLs and API endpoint references are standard documentation examples. No executable code, no prompt injection attempts, and no malicious patterns were found. The skill is safe for publication.
Quality Score
What You Can Build
Flutter developer adding AI features
A Flutter developer integrates AI-powered text generation, image recognition, and tool calling into their mobile application using Genkit Dart.
Dart backend engineer building AI agents
A backend engineer defines Genkit flows with structured outputs and integrates multiple AI model providers including Google Gemini and Anthropic Claude.
Team adopting Model Context Protocol
A development team implements MCP host and server configurations to connect Genkit-powered applications with external tool servers.
Try These Prompts
Write a Dart function that initializes Genkit with the Google AI plugin and generates a response to a user prompt using the Gemini model.
Show me how to define a Genkit tool in Dart using schemantic for the input schema, with a function that returns weather data for a given location.
Write a Genkit flow in Dart that accepts a topic string, generates a story using Gemini, streams the output chunks via context.sendChunk, and returns a completion message.
Show me how to configure an MCP host in Genkit Dart that connects to a filesystem MCP server using npx, and how to reference the aggregated tools in a generate call.
Best Practices
- Read API keys from environment variables using Platform.environment rather than hardcoding them in source files
- Use the schemantic library with @Schema annotations for all tool input and flow output schemas to ensure type safety
- Wrap Genkit flows with startFlowServer or integrate with existing Shelf routers for production HTTP endpoints
Avoid
- Hardcoding API keys directly in Dart source files instead of using environment variables
- Skipping the build_runner step after defining schemantic schemas, which prevents code generation
- Binding HTTP servers to all network interfaces in production instead of localhost for development endpoints