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

插件详情v25.9.23

flat_buffers

Dart 的 FlatBuffers 读写库。基于 Dart SDK 团队的 Konstantin Scheglov 和 Paul Berry 的原始工作。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
27.7万
喜欢数
45
Pub 分数
140

安装插件

flutter pub add flat_buffers

插件介绍

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

一个用于读写 FlatBuffers(一种高性能序列化格式)的 Dart 库。它能够在系统间实现高效的数据交换,内存开销极小,无需解析或复制数据。基于 Dart SDK 团队的 Konstantin Scheglov 和 Paul Berry 的原始工作,支持跨平台使用,涵盖 Android、iOS、Web、macOS、Windows 和 Linux。适用于需要快速、紧凑数据序列化的应用,如游戏、实时系统和移动应用。

适合场景

  • 高性能数据序列化
  • 跨平台数据交换
  • 游戏开发
  • 实时数据处理
  • 移动应用数据存储
  • 嵌入式系统

主要特点

  • 零拷贝反序列化
  • 最小内存使用
  • 跨平台兼容性
  • 快速读写操作
  • 支持架构定义
  • 从 .fbs 文件生成的代码

适合对象

  • 性能关键的应用程序
  • 需要快速数据访问的移动和Web应用
  • 游戏和模拟
  • 数据密集型后端服务
  • 内存资源有限的系统

使用建议

  • 需要架构定义(.fbs 文件)
  • 新用户的上手难度
  • 有限的可读输出
  • 由于二进制格式,不太适合调试
  • 需要代码生成步骤

原始 README

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

logo FlatBuffers

Build status BuildKite status Fuzzing Status Discord Chat Twitter Follow Twitter Follow

FlatBuffers is a cross platform serialization library architected for maximum memory efficiency. It allows you to directly access serialized data without parsing/unpacking it first, while still having great forwards/backwards compatibility.

Quick Start

  1. Build the compiler for flatbuffers (flatc)

    Use cmake to create the build files for your platform and then perform the compilation (Linux example).

    cmake -G "Unix Makefiles"
    make -j
    
  2. Define your flatbuffer schema (.fbs)

    Write the schema to define the data you want to serialize. See monster.fbs for an example.

  3. Generate code for your language(s)

    Use the flatc compiler to take your schema and generate language-specific code:

    ./flatc --cpp --rust monster.fbs
    

    Which generates monster_generated.h and monster_generated.rs files.

  4. Serialize data

    Use the generated code, as well as the FlatBufferBuilder to construct your serialized buffer. (C++ example)

  5. Transmit/store/save Buffer

    Use your serialized buffer however you want. Send it to someone, save it for later, etc...

  6. Read the data

    Use the generated accessors to read the data from the serialized buffer.

    It doesn't need to be the same language/schema version, FlatBuffers ensures the data is readable across languages and schema versions. See the Rust example reading the data written by C++.

Documentation

Go to our landing page to browse our documentation.

Supported operating systems

  • Windows
  • macOS
  • Linux
  • Android
  • And any others with a recent C++ compiler (C++ 11 and newer)

Supported programming languages

Code generation and runtime libraries for many popular languages.

  1. C
  2. C++ - snapcraft.io
  3. C# - nuget.org
  4. Dart - pub.dev
  5. Go - go.dev
  6. Java - Maven
  7. JavaScript - NPM
  8. Kotlin
  9. Lobster
  10. Lua
  11. PHP
  12. Python - PyPI
  13. Rust - crates.io
  14. Swift - swiftpackageindex
  15. TypeScript - NPM
  16. Nim

Versioning

FlatBuffers does not follow traditional SemVer versioning (see rationale) but rather uses a format of the date of the release.

Contribution

To contribute to this project, see CONTRIBUTING.

Community

Security

Please see our Security Policy for reporting vulnerabilities.

Licensing

Flatbuffers is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.


所属分类

源码仓库

使用此插件的项目