搜索插件、代码仓与 APP 分类

插件详情v1.1.2

jni

一个用于从 Dart 和 Flutter 访问 JNI 的库,作为 package:jnigen 的支持库。

AndroidWindowsLinux
近 30 天下载
1050万
喜欢数
64
Pub 分数
160

安装插件

flutter pub add jni

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

jni 包提供了一个 Dart 库,用于从 Flutter 和 Dart 访问 Java 原生接口(JNI),实现与原生 Android 代码的无缝互操作。它作为 jnigen 的基础支持库,简化了使用 C 或 C++ 编写的原生代码与 Dart 应用程序的集成。该包专为 Android、Windows 和 Linux 平台设计,允许开发者直接从 Dart 调用原生函数,从而促进性能关键型操作和对平台特定功能的访问。该包是 Dart Native 生态系统的一部分,推动高效的跨平台原生集成。

适合场景

  • 从 Dart 调用原生 C/C++ 函数
  • 集成 Android 原生库
  • 构建高性能 Flutter 插件
  • 使用平台特定代码扩展 Flutter 应用
  • 通过 JNI 启用低级别系统访问

主要特点

  • 从 Dart 直接访问 JNI
  • 支持 Android、Windows 和 Linux
  • 与 jnigen 的代码生成集成
  • 低级别原生函数调用
  • 跨平台原生互操作性

适合对象

  • 开发原生插件的开发者
  • 需要高性能原生调用的团队
  • 在 Android 上使用 C/C++ 库的项目
  • 需要直接 JNI 交互的 Flutter 应用
  • 使用原生代码的高级Flutter开发人员

使用建议

  • 需要了解 JNI 和原生开发
  • 仅限支持 JNI 的平台
  • 不建议初学者使用
  • 可能增加应用复杂性
  • 依赖 jnigen 以获得完整功能

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Coverage Status

Overview

This repository is home to Dart packages related to FFI and native assets building and bundling.

Documentation

See the doc directory for more documentation.

Packages

Package Description Issues Version
code_assets This package contains the Dart API for code assets in hook/build.dart and hook/link.dart. issues pub package
data_assets This package contains the Dart API for data assets in hook/build.dart and hook/link.dart. issues pub package
ffi Utilities for working with Foreign Function Interface (FFI) code. issues pub package
ffigen Generator for FFI bindings, using LibClang to parse C, Objective-C, and Swift files. issues pub package
hooks This package contains the API for hook/build.dart and hook/link.dart. issues pub package
hooks_runner This package is the backend that invokes hook/build.dart and hook/link.dart from Dart and Flutter. issues pub package
jni A library to access JNI from Dart and Flutter that acts as a support library for package:jnigen. issues pub package
jni_flutter A library to access Flutter Android specific APIs from Dart. issues pub package
jni_util A library to access Flutter Android specific APIs from Dart. issues pub package
jnigen A Dart bindings generator for Java and Kotlin that uses JNI under the hood to interop with Java virtual machine. issues pub package
native_toolchain_c A library to invoke the native C compiler installed on the host machine. issues pub package
objective_c A library to access Objective C from Flutter that acts as a support library for package:ffigen. issues pub package
record_use Dart API to access @RecordUse() recorded usages in link hooks. issues pub package
swift2objc A tool for generating bindings that allow interop between Dart and Swift code. issues pub package
swiftgen A tool for generating bindings that allow interop between Dart and Swift code. issues pub package

External packages

Packages not on this repo but also related to FFI and native assets. ❤️

Package Description Version
native_toolchain_cmake A library to invoke CMake for Dart Native Assets. pub package
native_toolchain_go A library to invoke the native Go compiler installed on the host machine. pub package
native_toolchain_ninja A library to invoke Ninja for Dart Native Assets. pub package
native_toolchain_rust A library to build and bundle Rust code for Dart Native Assets. pub package
native_toolchain_zig A library to build and bundle Zig code for Dart Native Assets. pub package

Publishing automation

For information about our publishing automation and release process, see https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.

For additional information about contributing, see our contributing page.

所属分类

依赖

依赖清单 8 项

源码仓库

使用此插件的项目