Google's official agent skill for writing production Maps Platform code — grounded in freshly fetched docs, with a demo key path that needs no billing account.
Dart Native Assets & C InteropSkill
Summary
Compile C/C++ into Dart Code Assets with build and link hooks — local toolchain builds with linker tree-shaking, or hash-validated downloads of prebuilt libraries.
Features
- Writes hook/build.dart and hook/link.dart against package:hooks and native_toolchain_c
- Local C/C++ compilation with per-platform host toolchain setup
- Linker tree-shaking via package:record_use to drop unreached native symbols
- Alternative path: downloading precompiled dynamic libraries
- Cryptographic hash validation on downloaded binaries
- Covers both plain Dart packages and Flutter plugins
Install This Skill
Add this skill to your favorite AI agent in a few steps.
Skill Content
Usage Instructions
Learn how to use this skill with different AI agents.
Example Usage
Setup native assets and compile my C code with build and link hooks.
Description
Dart's Native Assets feature lets a package ship compiled C or C++ alongside its Dart code, so a consumer runs dart run or builds a Flutter app and the native library is produced and bundled automatically. Getting there means writing hook/build.dart and hook/link.dart against package:hooks and package:native_toolchain_c — orchestration that is easy to describe and fiddly to get right. This is the Dart team's skill for that job.
Two integration paths
Local compilation with linker tree-shaking is the recommended route. The skill covers the host compiler toolchains you need per platform, laying out C sources and bindings, writing the build spec for the library, and implementing both hooks. The link hook is where package:record_use comes in: it maps which native symbols the Dart code actually reaches so the linker can drop the rest, which matters when a large C library would otherwise be shipped whole into a mobile binary.
Downloading precompiled dynamic libraries is the alternative when building from source is impractical. The skill's framing here is the security one — a build hook that downloads a binary is a supply-chain surface, so it orchestrates downloads with cryptographic hash validation rather than fetching and trusting.
Why hand this to an agent
The failure modes in native asset hooks are unforgiving: a hook that compiles on the author's macOS machine and fails on a Linux CI runner, a tree-shaking configuration that strips a symbol reached only through FFI lookup, a download step with no integrity check. The skill encodes the workflow — add dependencies, define C specifications, implement the hooks, run the hook cycle — along with the constraints that decide which approach fits, so the agent is not improvising toolchain orchestration.
It applies to plain Dart packages and Flutter plugins alike. Install with npx skills add dart-lang/skills --skill '*' --agent universal --yes.
Related Skills
Railway's official agent skill: create projects, provision databases and buckets, deploy, manage variables and domains, and read build failures back — from the CLI, API or MCP server.
Diagnoses wrong gradients in differentiable NVIDIA Warp programs by measuring first — comparing autodiff against finite differences on a shrunk reproduction before proposing any fix.
Google's official skill for the gws CLI — drive Gmail, Drive, Calendar, Sheets, Docs, Chat and Admin APIs from an agent, with Model Armor screening.