К основному содержанию
скилл Claude Code CX Codex Cursor GitHub Copilot

dart-setup-ffi-assets — скилл для Claude Code: компиляция C/C++

Скилл помогает агентам автоматизировать компиляцию и упаковку кода на C/C++ в динамические или статические библиотеки через систему Native Assets в Dart. Нужен, если вы интегрируете нативный код в Flutter или Dart-пакеты.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add flutter/agent-plugins --skill dart-setup-ffi-assets -a claude-code
Открыть на GitHub

Что делает dart-setup-ffi-assets

dart-setup-ffi-assets управляет двумя хуками — hook/build.dart и hook/link.dart, которые запускаются во время разработки (при dart run, dart test, flutter run). Первый компилирует исходники C/C++ или загружает предсобранные библиотеки; второй применяет оптимизацию tree-shaking, удаляя неиспользуемые символы из нативного кода.

Скилл использует package:native_toolchain_c для автоматического обнаружения доступных компиляторов (GCC, Clang, MSVC) и package:hooks для оркестрации этапов сборки. Для скачивания предсобранных бинарников работает с MD5/SHA-256 верификацией, чтобы гарантировать целостность и предотвратить подмену. Все пути нужно задавать через Platform.script.resolve() или URI для портативности между платформами.

Добавьте в pubspec.yaml зависимости code_assets, hooks, native_toolchain_c и record_use. Каждый файл — как сгенерированный, так и написанный вручную — должен содержать заголовок с авторским правом пакета. Если используется tree-shaking, создайте файл маппинга символов под lib/src/third_party/ с расширением .g.dart.

Какие задачи решает

  • Настроить хуки build.dart и link.dart для компиляции C/C++ кода
  • Упаковать нативные библиотеки как Code Assets в Dart-пакеты
  • Применить tree-shaking для сжатия размера нативного бинарника
  • Загрузить и верифицировать предсобранные динамические библиотеки по хешам
  • Обеспечить портативность сборки на разных хостовых компиляторах

Примеры запросов агенту

  • Настрой Native Assets для интеграции C кода через hook/build.dart и hook/link.dart с tree-shaking оптимизацией
  • Добавь скилл dart-setup-ffi-assets и помоги мне скомпилировать C исходники в статическую библиотеку для Flutter
  • Реализуй загрузку предсобранных бинарников с верификацией по SHA-256 для оффлайн-совместимости

Как установить dart-setup-ffi-assets

1Через Skills CLI (Vercel)

npx skills add flutter/agent-plugins --skill dart-setup-ffi-assets -a claude-code

2Вручную: положить файлы

~/.claude/skills/dart-setup-ffi-assets/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/dart-setup-ffi-assets/

Из того же набора14

Весь набор →
flutter-apply-architecture-best-practices flutter Скилл раскладывает Flutter-приложение по слоям UI, Logic и Data. Пригодится для нового проекта или рефакторинга кода. Claude Code CX Codex Cursor +1 43 000установок flutter-build-responsive-layout flutter Скилл обучает агента строить адаптивные интерфейсы Flutter под экраны телефонов и десктопов. Он задаёт правила работы с LayoutBuilder и MediaQuery. Claude Code CX Codex Cursor +1 42 300установок flutter-add-widget-test flutter Скилл помогает писать компонентные тесты Flutter с помощью WidgetTester. Проверяет, как виджет отображается и реагирует на касания, скролл и ввод текста. Claude Code CX Codex Cursor +1 39 000установок flutter-add-integration-test flutter Скилл настраивает интеграционные тесты во Flutter через пакет integration_test. Он переносит действия из MCP-сервера в готовые тестовые сценарии. Claude Code CX Codex Cursor +1 38 000установок flutter-setup-declarative-routing flutter Настраивает декларативную маршрутизацию Flutter через go_router: маршруты по URL, вложенную навигацию и глубокие ссылки для веба и мобильных платформ. Claude Code CX Codex Cursor +1 37 600установок flutter-implement-json-serialization flutter Скилл учит агента создавать Dart-модели с методами fromJson и toJson через библиотеку dart:convert. Пригодится при ручном разборе простых структур данных в Flutter. Claude Code CX Codex Cursor +1 37 200установок flutter-add-widget-preview flutter Скилл учит агента создавать интерактивные превью виджетов во Flutter через package:flutter/widget_previews.dart. Пригодится для изолированной вёрстки UI без сборки всего приложения. Claude Code CX Codex Cursor +1 36 600установок flutter-setup-localization flutter Скилл автоматизирует инициализацию поддержки многоязычности в Flutter-проекте. Добавляет зависимости, включает генерацию кода и создаёт конфиг для работы с .arb-файлами. Claude Code CX Codex Cursor +1 36 600установок

Похожие

chat-sdk vercel Помогает создавать мультиплатформенных чат-ботов на TypeScript с помощью Chat SDK от Vercel. Пригодится при настройке логики для Slack, Discord, Telegram или WhatsApp. Claude Code CX Codex Cursor +1 5 400установок ce-setup EveryInc Проверяет окружение Compound Engineering, валидирует конфиг репозитория и создаёт новые Pack'и. Нужен, если вы уже используете Compound Engineering или хотите начать. Claude Code CX Codex Cursor +1 3 300установок korean-jangbu-for NomaDamas Скилл для автоматизации учёта микробизнеса в Корее: импорт данных, классификация операций по счетам, подготовка отчётов для налогового консультанта и управленческие выводы. Claude Code CX Codex Cursor +1 6 000установок k-skill-cleaner NomaDamas Скилл проверяет статистику вызовов установленных K-скиллов и опрашивает разработчика, чтобы предложить удалить лишние навыки из окружения агента. Claude Code CX Codex Cursor +1 6 000установок ctx-upgrade mksglu Скилл автоматически обновляет context-mode с GitHub, пересобирает плагин, переустанавливает глобально и настраивает хуки. Запускается одной командой. Claude Code CX Codex Cursor +1 1 600установок setup-matt-pocock-skills Matt Pocock Скилл настраивает репозиторий для инженерных скиллов Matt Pocock: задаёт трекер задач, метки триажа и расположение доменной документации. Запустите его перед первым использованием остальных скиллов. Claude Code 1 052 851установок to-tickets Matt Pocock Разбивает план, спецификацию или переписку на небольшие сквозные задачи и отмечает, какие из них блокируют остальные. Пригодится, когда нужно согласовать порядок работы до публикации задач в трекере. Claude Code 711 230установок writing-plans Jesse Vincent Скилл превращает требования к многошаговой задаче в подробный план реализации до начала работы с кодом. Пригодится, когда исполнителю нужно зафиксировать файлы, интерфейсы и проверки. Claude Code CX Codex 282 859установок

Вопросы о dart-setup-ffi-assets

Как установить dart-setup-ffi-assets в Claude Code?

Выполните npx skills add flutter/agent-plugins --skill dart-setup-ffi-assets -a claude-code, затем повторите команду ещё раз и откройте ~/.claude/skills/dart-setup-ffi-assets/SKILL.md для проверки.

Что делает dart-setup-ffi-assets?

Помогает агентам автоматизировать компиляцию C/C++ кода и упаковку его в Native Assets через хуки Dart. Управляет build.dart и link.dart, применяет tree-shaking для оптимизации размера, верифицирует загруженные бинарники по хешам.

Какие зависимости нужны для работы скилла?

Добавьте в pubspec.yaml: code_assets, hooks, native_toolchain_c, record_use (обычные зависимости) и ffigen (dev-зависимость). Все пути разрешайте через Platform.script.resolve() для портативности.

Исходный текст

SKILL.md · BSD-3-Clause
---
name: dart-setup-ffi-assets
description: "Guides agents in compiling and packaging C/C++ source code into dynamic or static libraries (Code Assets) using Dart's Native Assets hook system (via hook/build.dart and hook/link.dart utilizing package:hooks and package:native_toolchain_c). Use when a user asks to: 'setup native assets', 'compile C/C++ source code', 'bundle dynamic libraries', 'build native C code', 'link native assets', 'implement build.dart or link.dart hooks', or 'integrate C/C++ interop in Dart/Flutter'. Helps agents avoid manual toolchain orchestration and configures secure hash-validated binary downloads or advanced linker tree-shaking with package:record_use mapping."
metadata:
  model: models/gemini-3.1-pro-preview
  last_modified: Fri, 29 May 2026 09:10:00 GMT
---
# Compiling C Code into Code Assets with Native Assets Hooks

Integrate and automate the compilation and packaging of native C/C++ source code into **Code Assets** under Dart's overarching **Native Assets** feature using build and link hooks.

## Contents
- [Introduction](#introduction)
- [Constraints](#constraints)
- [Native Interop Packages](#native-interop-packages)
- [Step-by-Step Workflow](#step-by-step-workflow)
- [Choosing an Integration Approach](#choosing-an-integration-approach)
- [Method 1: Local Compilation with Linker Tree-Shaking (Recommended)](#method-1-local-compilation-with-linker-tree-shaking-recommended)
  - [Prerequisite Host Compiler Toolchains](#prerequisite-host-compiler-toolchains)
  - [C Source and Bindings Setup](#c-source-and-bindings-setup)
  - [Defining the C Library Build Spec](#defining-the-c-library-build-spec)
  - [Implementing hook/build.dart](#implementing-hookbuilddart)
  - [Implementing hook/link.dart](#implementing-hooklinkdart)
- [Method 2: Downloading Precompiled Dynamic Libraries](#method-2-downloading-precompiled-dynamic-libraries)
  - [Why Download Precompiled Binaries?](#why-download-precompiled-binaries)
  - [Implementing Precompiled Dynamic Downloads](#implementing-precompiled-dynamic-downloads)
- [Verification Checklist](#verification-checklist)
  - [1. Local Execution Sandbox](#1-local-execution-sandbox)
  - [2. Verify Target Outputs](#2-verify-target-outputs)
  - [3. Verify Tree-Shaking Stripping](#3-verify-tree-shaking-stripping)
  - [4. Verify Offline Compliance (User Defines)](#4-verify-offline-compliance-user-defines)

---

## Introduction

Under Dart's **Native Assets** feature, packages can package native code (like C/C++ libraries) as **Code Assets** and bundle them automatically during standard development cycles (e.g., `dart run`, `dart test`, `dart build`, and `flutter run`). The packaging of **Code Assets** is driven by two programmatic hook scripts placed inside a package's `hook/` folder:

1.  `hook/build.dart`: Compiles local C sources to machine code or bundles prebuilt native binaries as code assets for a specific host/target architecture.
2.  `hook/link.dart`: Links built code assets, applying advanced tree-shaking optimizations to strip unused native symbols and compress the runtime binary size.

---

## Constraints

> [!IMPORTANT]
> Keep all file resolving platform-independent. Never hardcode absolute target paths, shell scripts, or system command variables. Always use `Platform.script.resolve()` or `Uri`-based resolution to ensure scripts are fully portable.

*   **Hook Locations**: Compiling and packaging hooks must reside strictly inside the `hook/` directory at the package's root:
    *   `hook/build.dart` (Build execution phase)
    *   `hook/link.dart` (Optional packaging/linking/tree-shaking phase)
*   **Compile Toolchain Standard**: Use the programmatic APIs from `package:native_toolchain_c` (e.g. `CBuilder` and `CLibrary`) to run compile toolchains. Never invoke raw `gcc`, `clang`, or `msvc` via shell commands.
*   **Preamble & License Headers**: Every handcrafted and generated source file (including bindings, helpers, and hooks) must strictly contain the target package's copyright and licensing header.
*   **Tree Shaking Mapping**: If utilizing compiler tree-shaking, you must map the target Dart method names (e.g. `Method.name`) back to their raw native C symbol names using a record use mapping generated by FFIgen. The mapping file must reside under `lib/src/third_party/` and strictly use the `.g.dart` extension (e.g., `sqlite3.record_use_mapping.g.dart`).
*   **Integrity Safeguards for Precompiled Libraries**: If adopting the dynamic download pattern:
    *   **Cryptographic Verification**: Downloaded prebuilt binaries must be checked against preconfigured lookup tables containing MD5 or SHA-256 hashes to guarantee binary integrity and prevent tampering.
    *   **Graceful Recovery**: Support offline developers by providing fallbacks (such as local compiler execution via flags like `local_build`).

---

## Native Interop Packages

Programmatic build and link hooks for **Code Assets** leverage three specialized native interop packages:

| Dependency | Purpose | Key API Abstractions |
| :--- | :--- | :--- |
| **`package:hooks`** | Main orchestrator defining execution bounds. | `build(args, callback)`, `link(args, callback)` |
| **`package:native_toolchain_c`** | Detects local compilers (MSVC, Xcode/Clang, GCC) and executes build toolchains. | `CLibrary`, `CBuilder`, `LinkerOptions.treeshake` |
| **`package:code_assets`** | Models code metadata records passed to dynamic loaders. | `CodeAsset`, `DynamicLoadingBundled` |

---

## Step-by-Step Workflow

### Step 1: Add Dependencies
Add Code Assets hook and toolchain dependencies to your package. You must fetch these dependencies directly from **pub.dev**.

You can add it automatically using the CLI:
```bash
dart pub add code_assets hooks native_toolchain_c record_use dev:ffigen
```

Or manually declare them in your target package's `pubspec.yaml`:
```yaml
dependencies:
  code_assets: ^1.0.0
  hooks: ^0.1.0
  native_toolchain_c: ^0.1.0
  record_use: ^0.6.0

dev_dependencies:
  ffigen: ^20.1.1
```

### Step 2: Define C Specifications
Define your target C library compilation metadata inside `lib/src/c_library.dart`. This lets both the build and link hooks share a single source of truth for assets, names, and sources.

### Step 3: Implement Build and Link Hook Scripts
Write the compilation orchestration script inside `hook/build.dart` and the dead-code elimination logic inside `hook/link.dart`.

### Step 4: Run the Hook Cycle
Running standard test suites dynamically launches the build and link hook lifecycle in the background:
```bash
dart test
```

---

## Choosing an Integration Approach

There are two primary methods for integrating and delivering C/C++ native assets in Dart. Select the one that matches your project requirements:

| Aspect | Method 1: Local Compilation & Tree-Shaking | Method 2: Precompiled Downloads |
| :--- | :--- | :--- |
| **Primary Use Case** | When C/C++ source code is included directly in the package and you want maximum size optimization. | When compiling locally is slow/complex, or when avoiding developer host toolchain requirements. |
| **Host Toolchain Requirements** | Requires pre-installed platform C compiler (Xcode tools, MSVC, GCC). | Zero compiler setup required on developer/user machines. |
| **Binary Optimization** | Premium. Unused symbols are completely tree-shaken, decreasing library size. | Standard. Standard compiled binaries are shipped as-is. |
| **Offline Setup** | Fully compliant. Works completely offline. | Requires network access to download libraries, with offline fallback. |

---

## Method 1: Local Compilation with Linker Tree-Shaking (Recommended)

In this approach, the build hook invokes local toolchains (GCC, Clang, MSVC) to compile source files directly. The link hook subsequently filters output symbols utilizing compiler options, retaining only target methods invoked in user code. This represents the standard, robust SQLite pattern under `pkgs/code_assets/example/sqlite`.

### Prerequisite Host Compiler Toolchains

Since `package:native_toolchain_c` delegates actual dynamic compilation to the host operating system's default toolchain, the development machine **must** have one of the following compiler packages pre-installed:

*   **macOS**: Xcode Command Line Tools. Install via:
    ```bash
    xcode-select --install
    ```
*   **Linux**: GCC or Clang. Install via:
    ```bash
    sudo apt install build-essential
    ```
*   **Windows**: MSVC (Microsoft Visual C++). Install the **Visual Studio Installer** and select the **Desktop development with C++** workload.

*Note: If no compatible toolchain is discovered on the host path, the build hook script will throw a compilation execution exception. Ensure to specify compiler constraints or adopt Method 2 if toolchains cannot be guaranteed.*

### C Source and Bindings Setup

Assume a C source defining simple math functions at `third_party/sqlite/sqlite3.c` with its entry point header at `third_party/sqlite/sqlite3.h`:

```c
#ifndef SQLITE3_H_
#define SQLITE3_H_

const char *sqlite3_libversion(void);

#endif // SQLITE3_H_
```

We utilize a programmatic FFIgen script (`tool/ffigen.dart`) to create FFI bindings in `lib/src/third_party/sqlite3.g.dart`, enabling recorded usage tracking and producing the lookup metadata map in `lib/src/third_party/sqlite3.record_use_mapping.g.dart`:

```dart
// AUTO-GENERATED FILE - DO NOT MODIFY.
// Generated via ffigen.

const recordUseMapping = {
  'sqlite3_libversion': 'sqlite3_libversion',
};
```

### Defining the C Library Build Spec

Define the centralized library specification in `lib/src/c_library.dart`:

```dart
import 'package:native_toolchain_c/native_toolchain_c.dart';

/// The C build specification for the sqlite library.
final cLibrary = CLibrary(
  name: 'sqlite3',
  assetName: 'src/third_party/sqlite3.g.dart',
  sources: ['third_party/sqlite/sqlite3.c'],
);
```

### Implementing `hook/build.dart`

Implement `hook/build.dart` using `CLibrary.build`. This builds the library to a dynamic library (e.g. `.so`, `.dylib`, or `.dll`) inside the hook's target directory:

```dart
import 'package:code_assets/code_assets.dart';
import 'package:hooks/hooks.dart';
import 'package:sqlite/src/c_library.dart';

void main(List<String> args) async {
  await build(args, (input, output) async {
    if (input.config.buildCodeAssets) {
      await cLibrary.build(
        input: input,
        output: output,
        defines: {
          if (input.config.code.targetOS == OS.windows)
            // Ensure C functions are explicitly exported in the Windows DLL
            'SQLITE_API': '__declspec(dllexport)',
        },
      );
    }
  });
}
```

### Implementing `hook/link.dart`

Implement the link optimization phase in `hook/link.dart`. This utilizes compiler tree-shaking options (`LinkerOptions.treeshake`) to compile a minimized, dead-code-eliminated binary based on symbol usage records:

```dart
import 'package:hooks/hooks.dart';
import 'package:native_toolchain_c/native_toolchain_c.dart';
import 'package:record_use/record_use.dart';
import 'package:sqlite/src/c_library.dart';
import 'package:sqlite/src/third_party/sqlite3.record_use_mapping.g.dart';

void main(List<String> arguments) async {
  await link(arguments, (input, output) async {
    await cLibrary.link(
      input: input,
      output: output,
      linkerOptions: LinkerOptions.treeshake(
        // Map Dart Method references back to raw C symbol names
        symbolsToKeep: input.recordedUses?.calls.keys.cast<Method>().map(
          (e) => recordUseMapping[e.name]!,
        ),
      ),
    );
  });
}
```

---

## Method 2: Downloading Precompiled Dynamic Libraries

An alternative approach compiles binaries beforehand on a central build machine, archives them, and downloads the target binary during the build hook execution. This matches the paradigm demonstrated in the `download_asset` hook package.

### Why Download Precompiled Binaries?

*   **Host Constraints**: Compiling large C/C++ libraries locally requires a complete compiler setup (GCC, Xcode/SDKs, Visual Studio) that the end-developer's host machine may not possess.
*   **Compile Speed**: Precompiled downloads execute in milliseconds compared to potentially long multi-minute compilation processes.
*   **Platform Bridging**: Allows cross-compiling constraints to be avoided if host architectures are limited.

---

### Implementing Precompiled Dynamic Downloads

We configure our build hook to detect local compiler flags (e.g. `local_build`). If not specified, the hook utilizes `HttpClient` to pull down platform-specific libraries, calculates the MD5 hash to confirm download safety against a configured hashes lookup table, and registers the binary file as a `CodeAsset`:

#### 1. Defining Target Hashes (`lib/src/hook_helpers/hashes.dart`)
Define target MD5 hash checks per platform file in your package sources:

```dart
const assetHashes = {
  'libnative_add_macos_arm64.dylib': '4a88f50438a98402db2dbd47b59eb412',
  'libnative_add_linux_x64.so': '9f5e15043aa98402dcdbbd47b59ea520',
  'native_add_windows_x64.dll': 'a881e5043ba98402acdebd47b59fa321',
};
```

#### 2. Hook Downloader Helper (`lib/src/hook_helpers/download.dart`)
Implement the downloading and integrity check logic using dynamic target filename matching:

```dart
import 'dart:io';
import 'package:code_assets/code_assets.dart';
import 'package:crypto/crypto.dart';

const version = '1.0.0';

Uri downloadUri(String target) => Uri.parse(
  'https://github.com/my-org/my-native-repo/releases/download/$version/$target',
);

Future<File> downloadAsset(
  OS targetOS,
  Architecture targetArchitecture,
  Directory outputDir,
) async {
  final fileName = targetOS.dylibFileName('native_add_${targetOS.name}_${targetArchitecture.name}');
  final uri = downloadUri(fileName);
  
  final client = HttpClient()..findProxy = HttpClient.findProxyFromEnvironment;
  final request = await client.getUrl(uri);
  final response = await request.close();
  
  if (response.statusCode != 200) {
    throw ArgumentError('Download target $uri failed: Code ${response.statusCode}');
  }
  
  final targetFile = File.fromUri(outputDir.uri.resolve(fileName));
  await targetFile.create(recursive: true);
  await response.pipe(targetFile.openWrite());
  
  return targetFile;
}

Future<String> hashAsset(File file) async {
  return md5.convert(await file.readAsBytes()).toString();
}
```

#### 3. Implementing `hook/build.dart`

Write the final download build hook incorporating local compilation fallback:

```dart
import 'dart:io';
import 'package:code_assets/code_assets.dart';
import 'package:hooks/hooks.dart';
import 'package:my_download_package/src/hook_helpers/hashes.dart';
import 'package:my_download_package/src/hook_helpers/download.dart';
import 'package:native_toolchain_c/native_toolchain_c.dart';

void main(List<String> args) async {
  await build(args, (input, output) async {
    final localBuild = input.userDefines['local_build'] as bool? ?? false;

    if (localBuild) {
      final name = 'native_add_${input.config.code.targetOS.name}_${input.config.code.targetArchitecture.name}';
      final builder = CBuilder.library(
        name: name,
        assetName: 'native_add.dart',
        sources: ['src/native_add.c'],
      );
      await builder.run(input: input, output: output);
    } else {
      final targetOS = input.config.code.targetOS;
      final targetArch = input.config.code.targetArchitecture;
      final outputDir = Directory.fromUri(input.outputDirectory);

      final file = await downloadAsset(targetOS, targetArch, outputDir);

      final fileHash = await hashAsset(file);
      final expectedFileName = targetOS.dylibFileName('native_add_${targetOS.name}_${targetArch.name}');
      final expectedHash = assetHashes[expectedFileName];

      if (fileHash != expectedHash) {
        throw Exception(
          'Security Mismatch: File $expectedFileName hash verification failed! '
          'Found hash: $fileHash, expected: $expectedHash.'
        );
      }

      output.assets.code.add(
        CodeAsset(
          package: input.packageName,
          name: 'native_add.dart',
          linkMode: DynamicLoadingBundled(),
          file: file.uri,
        ),
      );
    }
  });
}
```

---

## Verification Checklist

Before declaring a build or link hook implementation complete, always perform the following checks:

### 1. Local Execution Sandbox
Run unit tests and confirm the native assets compile/link process completes with no runtime or build tool exceptions:
```bash
dart test
```

### 2. Verify Target Outputs
Navigate to your package target directory and verify that dynamic binary assets are created for the host system:
*   **macOS**: Verify `.dart_tool/resources/` or target directories contain `.dylib` files.
*   **Linux**: Verify `.dart_tool/resources/` or target directories contain `.so` files.
*   **Windows**: Verify `.dart_tool/resources/` or target directories contain `.dll` files.

### 3. Verify Tree-Shaking Stripping
To ensure the link hook is actually stripping unused native symbols and compressing binary packaging, perform the following validation:

1. Compile a production bundle of the CLI/app:
   ```bash
   dart build cli bin/main.dart
   ```
2. Navigate to the compiled build directory containing the dynamic library.
3. Query the exported dynamic symbol tables:
   *   **macOS**:
       ```bash
       nm -gU build/cli/lib/libsqlite3.dylib
       ```
   *   **Linux**:
       ```bash
       nm -D build/cli/lib/libsqlite3.so
       ```
   *   **Windows** (using MSVC Developer Command Prompt):
       ```cmd
       dumpbin /EXPORTS build\cli\lib\sqlite3.dll
       ```
4. **Confirm Target Exports**: Verify that the command outputs **only** the explicitly kept entry point functions (e.g. `sqlite3_libversion`) and does not output any unreferenced/stripped symbols.
5. **No Bundle Scenario**: If the application does not import or invoke any methods from the native library:
   - Verify that the link hook logs: `Skipping linking as no symbols are to be kept.`
   - Verify that no library was built/placed in the production bundle (the `.dylib`/`.so`/`.dll` file is not generated, saving bundle size).

### 4. Verify Offline Compliance (User Defines)
Confirm offline compliance is fully active and the download fallback executes perfectly offline:

1. Configure the `local_build: true` define for your package in the package's `pubspec.yaml` (or the workspace root `pubspec.yaml`):
   ```yaml
   hooks:
     user_defines:
       <your_package_name>:
         local_build: true
   ```
2. Disable the machine's network adapter or run in a sandboxed offline shell.
3. Launch unit tests:
   ```bash
   dart test
   ```
4. Verify the test suite successfully compiles local source files using host compilers, has no compile errors, and never attempts network download requests.

© flutter · BSD-3-Clause · flutter/agent-plugins

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой