native_doctor 0.1.0-dev.4 copy "native_doctor: ^0.1.0-dev.4" to clipboard
native_doctor: ^0.1.0-dev.4 copied to clipboard

A tool that analyzes Flutter and Dart project dependencies, find requirements for native toolchains and, if possible, resolves issues.

Native Doctor #

native_doctor is a tool analyzes Flutter and Dart project dependencies, find requirements for native toolchains and, if possible, resolves issues.

Currently supported native toolchains:

  • NDK
  • Rust (through rustup)

Usage #

In your project directory, run:

dart pub global activate native_doctor
dart pub global run native_doctor

Features #

native_doctor can

  • Check for installed NDKs and install NDK if missing or outdated.
  • Checks whether Rust is installed and install Rust (through Rustup) if missing.
  • Check for installed Rust toolchains and targets and install missing toolchains and targets.

Supporting native_doctor in Flutter or Dart packages #

If your package depends on NDK or Rust being present during compilation, add a native_manifest.yaml file to the root of the package. This file contains minimal required versions of NDK and/or Rust toolchains.

Example native_manifest.yaml file:

version: 0.1.0
requirements:
  ndk:
    version: 26.0.0
  rust:
    stable:
      version: 1.77.2

Example native_manifest.yaml file if project only requires NDK:

version: 0.1.0
requirements:
  ndk:
    version: 26.0.0

Example native_manifest.yaml file if project only requires both stable and nightly Rust and NDK:

version: 0.1.0
requirements:
  ndk:
    version: 26.0.0
  rust:
    stable:
      version: 1.77.2
    nightly:
      version: 1.79.0-nightly

Example output of running native_doctor in a project with native dependencies:

Project: native_toolchain_rust_test (Flutter)
Buildable platforms: macos, ios, android

Native toolchain: NDK

  [✗] NDK installed, but too old
       ! Installed versions: 25.1.8937393, 23.1.7779620
       ! Required minimum version: 26.0.0

Native toolchain: Rust

  [✓] Rustup installed
  [✗] Toolchain stable-aarch64-apple-darwin (version 1.77.2)
       • Required minimum version: 1.77.2
       • Installed targets: aarch64-apple-darwin, aarch64-apple-ios,
         aarch64-apple-ios-sim, aarch64-linux-android, arm-linux-androideabi,
         x86_64-linux-android
       ! Missing targets: i686-linux-android, x86_64-apple-ios, x86_64-apple-darwin

Proposed actions:

  • (NDK)  Install NDK 26.0.0 or newer
  • (Rust) Install targets i686-linux-android, x86_64-apple-ios, x86_64-apple-darwin
           for toolchain stable-aarch64-apple-darwin

Do you want native doctor to perform proposed actions? (y/N)
2
likes
130
points
45
downloads

Publisher

verified publisherirondash.dev

Weekly Downloads

A tool that analyzes Flutter and Dart project dependencies, find requirements for native toolchains and, if possible, resolves issues.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

args, collection, logging, native_assets_cli, native_toolchain_rust_common, package_config, path, pub_semver, pubspec_parse, rustup, yaml

More

Packages that depend on native_doctor