This is an automated email from the ASF dual-hosted git repository.
chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fory-site.git
The following commit(s) were added to refs/heads/main by this push:
new f0ed6bbc1f 🔄 synced local 'docs/compiler/' with remote 'docs/compiler/'
f0ed6bbc1f is described below
commit f0ed6bbc1fef657a194f77c3d1f09eae4d476d72
Author: chaokunyang <[email protected]>
AuthorDate: Wed Apr 15 15:20:33 2026 +0000
🔄 synced local 'docs/compiler/' with remote 'docs/compiler/'
---
docs/compiler/compiler-guide.md | 72 ++++++++++++++++----
docs/compiler/generated-code.md | 145 ++++++++++++++++++++++++++++++++++++++++
docs/compiler/index.md | 15 +++--
docs/compiler/schema-idl.md | 83 +++++++++++++----------
4 files changed, 262 insertions(+), 53 deletions(-)
diff --git a/docs/compiler/compiler-guide.md b/docs/compiler/compiler-guide.md
index dc6585ea4c..70fe2e5b6b 100644
--- a/docs/compiler/compiler-guide.md
+++ b/docs/compiler/compiler-guide.md
@@ -66,6 +66,7 @@ Compile options:
| `--csharp_out=DST_DIR` | Generate C# code in DST_DIR
| (none) |
| `--javascript_out=DST_DIR` | Generate JavaScript code in DST_DIR
| (none) |
| `--swift_out=DST_DIR` | Generate Swift code in DST_DIR
| (none) |
+| `--dart_out=DST_DIR` | Generate Dart code in DST_DIR
| (none) |
| `--go_nested_type_style` | Go nested type naming: `camelcase`
or `underscore` | `underscore` |
| `--swift_namespace_style` | Swift namespace style: `enum` or
`flatten` | `enum` |
| `--emit-fdl` | Emit translated FDL (for non-FDL
inputs) | `false` |
@@ -116,7 +117,7 @@ foryc schema.fdl
**Compile for specific languages:**
```bash
-foryc schema.fdl --lang java,python,csharp,javascript,swift
+foryc schema.fdl --lang java,python,csharp,javascript,swift,dart
```
**Specify output directory:**
@@ -169,7 +170,7 @@ foryc src/main.fdl -I libs/common,libs/types --proto_path
third_party/
foryc schema.fdl --java_out=./src/main/java
# Generate multiple languages to different directories
-foryc schema.fdl --java_out=./java/gen --python_out=./python/src
--go_out=./go/gen --csharp_out=./csharp/gen --javascript_out=./javascript/src
--swift_out=./swift/gen
+foryc schema.fdl --java_out=./java/gen --python_out=./python/src
--go_out=./go/gen --csharp_out=./csharp/gen --javascript_out=./javascript/src
--swift_out=./swift/gen --dart_out=./dart/gen
# Combine with import paths
foryc schema.fdl --java_out=./gen/java -I proto/ -I common/
@@ -238,16 +239,17 @@ Compiling src/main.fdl...
## Supported Languages
-| Language | Flag | Output Extension | Description
|
-| ---------- | ------------ | ---------------- |
------------------------------------- |
-| Java | `java` | `.java` | POJOs with Fory annotations
|
-| Python | `python` | `.py` | Dataclasses with type hints
|
-| Go | `go` | `.go` | Structs with struct tags
|
-| Rust | `rust` | `.rs` | Structs with derive macros
|
-| C++ | `cpp` | `.h` | Structs with FORY macros
|
-| C# | `csharp` | `.cs` | Classes with Fory attributes
|
-| JavaScript | `javascript` | `.ts` | Interfaces with registration
function |
-| Swift | `swift` | `.swift` | `@ForyObject` Swift models
|
+| Language | Flag | Output Extension | Description
|
+| ---------- | ------------ | ---------------- |
-------------------------------------- |
+| Java | `java` | `.java` | POJOs with Fory annotations
|
+| Python | `python` | `.py` | Dataclasses with type hints
|
+| Go | `go` | `.go` | Structs with struct tags
|
+| Rust | `rust` | `.rs` | Structs with derive macros
|
+| C++ | `cpp` | `.h` | Structs with FORY macros
|
+| C# | `csharp` | `.cs` | Classes with Fory attributes
|
+| JavaScript | `javascript` | `.ts` | Interfaces with registration
function |
+| Swift | `swift` | `.swift` | `@ForyObject` Swift models
|
+| Dart | `dart` | `.dart` | `@ForyStruct` classes with
annotations |
## Output Structure
@@ -362,6 +364,21 @@ generated/
- Each schema includes `ForyRegistration` and `toBytes`/`fromBytes` helpers
- Imported schemas are registered transitively by generated registration
helpers
+### Dart
+
+```
+generated/
+└── dart/
+ └── package/
+ ├── package.dart
+ └── package.fory.dart
+```
+
+- Two files per schema: a main `.dart` file with annotated types, and a
`.fory.dart` part file with generated serializers
+- Package segments map to directories (e.g., `demo.foo` → `demo/foo/`)
+- Registration helper class included in the part file
+- Typed arrays used for non-optional, non-ref primitive lists (e.g.,
`Int32List`)
+
### C# IDL Matrix Verification
Run the end-to-end C# IDL matrix (FDL/IDL/Proto/FBS generation plus roundtrip
tests):
@@ -586,6 +603,30 @@ cc_library(
)
```
+### Dart / Flutter
+
+Add the Fory dependency to `pubspec.yaml`:
+
+```yaml
+dependencies:
+ fory: ^0.1.0
+
+dev_dependencies:
+ build_runner: ^2.4.0
+```
+
+Generate schema types with the compiler:
+
+```bash
+foryc schema.fdl --dart_out=lib/generated
+```
+
+Then run `build_runner` to generate the serializers:
+
+```bash
+dart run build_runner build
+```
+
## Error Handling
### Syntax Errors
@@ -755,3 +796,10 @@ fory = "x.y.z"
```
**C++:** Ensure Fory headers are in include path.
+
+**Dart:** Ensure the fory package is in `pubspec.yaml`:
+
+```yaml
+dependencies:
+ fory: ^0.1.0
+```
diff --git a/docs/compiler/generated-code.md b/docs/compiler/generated-code.md
index d6835b6439..87ea18cf45 100644
--- a/docs/compiler/generated-code.md
+++ b/docs/compiler/generated-code.md
@@ -860,6 +860,149 @@ With non-empty package and `flatten` style, the helper is
prefixed too (for exam
For schemas without explicit `[id=...]`, registration uses computed numeric
IDs.
If `option enable_auto_type_id = false;` is set, generated code uses
name-based registration APIs.
+## Dart
+
+### Output Layout
+
+Dart output is two files per schema: a main `.dart` file with annotated types,
and a `.fory.dart` part file with generated serializers and registration
helpers.
+
+- `<dart_out>/package/package.dart`
+- `<dart_out>/package/package.fory.dart`
+
+### Type Generation
+
+Messages generate `@ForyStruct` annotated `final class` declarations with
`@ForyField` on each field:
+
+```dart
+@ForyStruct()
+final class Person {
+ Person();
+
+ @ForyField(id: 1)
+ String name = '';
+
+ @ForyField(id: 2)
+ Int32 id = Int32(0);
+
+ @ForyField(id: 7)
+ List<Person_PhoneNumber> phones = <Person_PhoneNumber>[];
+
+ @ForyField(id: 8)
+ Animal pet = Animal._empty();
+}
+```
+
+Enums generate Dart `enum` declarations with a `rawValue` getter and
`fromRawValue` factory:
+
+```dart
+enum Person_PhoneType {
+ mobile,
+ home,
+ work;
+
+ int get rawValue => switch (this) {
+ Person_PhoneType.mobile => 0,
+ Person_PhoneType.home => 1,
+ Person_PhoneType.work => 2,
+ };
+
+ static Person_PhoneType fromRawValue(int value) => switch (value) {
+ 0 => Person_PhoneType.mobile,
+ 1 => Person_PhoneType.home,
+ 2 => Person_PhoneType.work,
+ _ => throw StateError('Unknown Person_PhoneType raw value $value.'),
+ };
+}
+```
+
+Unions generate `@ForyUnion` annotated classes with factory constructors, a
case enum, and a custom serializer:
+
+```dart
+enum AnimalCase {
+ dog,
+ cat;
+
+ int get id => switch (this) {
+ AnimalCase.dog => 1,
+ AnimalCase.cat => 2,
+ };
+}
+
+@ForyUnion()
+final class Animal {
+ final AnimalCase _case;
+ final Object? _value;
+
+ const Animal._(this._case, this._value);
+
+ factory Animal.dog(Dog value) => Animal._(AnimalCase.dog, value);
+ factory Animal.cat(Cat value) => Animal._(AnimalCase.cat, value);
+
+ bool get isDog => _case == AnimalCase.dog;
+ Dog get dogValue => _value as Dog;
+ // ...
+}
+```
+
+Nested types use flat underscore naming (e.g., `Person_PhoneNumber`,
`Person_PhoneType`).
+
+Non-optional, non-ref lists of primitive types use typed arrays for zero-copy
performance (e.g., `list<int32>` → `Int32List`).
+
+Reference tracking on list elements or map values uses `@ListType` /
`@MapType` annotations:
+
+```dart
+@ListType(element: ValueType.ref())
+@ForyField(id: 3)
+List<Node> children = <Node>[];
+
+@MapType(value: ValueType.ref())
+@ForyField(id: 2)
+Map<String, Node> byName = <String, Node>{};
+```
+
+### Registration
+
+Each schema includes a registration helper that handles all types in the file
and transitively registers imported types:
+
+```dart
+abstract final class ForyRegistration {
+ static void register(
+ Fory fory,
+ Type type, {
+ int? id,
+ String? namespace,
+ String? typeName,
+ }) {
+ if (type == Person) {
+ registerGeneratedStruct(fory, _personForyRegistration, id: id,
namespace: namespace, typeName: typeName);
+ return;
+ }
+ // ... other types
+ }
+}
+```
+
+### Usage
+
+```dart
+import 'package:fory/fory.dart';
+import 'generated/addressbook/addressbook.dart';
+
+void main() {
+ final fory = Fory();
+ ForyRegistration.register(fory, Person, id: 100);
+ ForyRegistration.register(fory, Dog, id: 104);
+ // ...
+
+ final person = Person()
+ ..name = 'Alice'
+ ..id = Int32(1);
+
+ final bytes = fory.serialize(person);
+ final roundTrip = fory.deserialize<Person>(bytes);
+}
+```
+
## Cross-Language Notes
### Type ID Behavior
@@ -880,6 +1023,7 @@ If `option enable_auto_type_id = false;` is set, generated
code uses name-based
| C# | `Person.PhoneNumber` |
| JavaScript | `Person.PhoneNumber` |
| Swift | `Person.PhoneNumber` |
+| Dart | `Person_PhoneNumber` |
### Byte Helper Naming
@@ -893,3 +1037,4 @@ If `option enable_auto_type_id = false;` is set, generated
code uses name-based
| C# | `ToBytes` / `FromBytes` |
| JavaScript | (via `fory.serialize()`) |
| Swift | `toBytes` / `fromBytes` |
+| Dart | (via `fory.serialize()`) |
diff --git a/docs/compiler/index.md b/docs/compiler/index.md
index 52408c7ffe..f79f322ddb 100644
--- a/docs/compiler/index.md
+++ b/docs/compiler/index.md
@@ -21,7 +21,7 @@ license: |
Fory IDL is a schema definition language for Apache Fory that enables type-safe
cross-language serialization. Define your data structures once and generate
-native data structure code for Java, Python, Go, Rust, C++, C#, Swift, and
JavaScript.
+native data structure code for Java, Python, Go, Rust, C++, C#, Swift,
JavaScript, and Dart.
## Example Schema
@@ -103,6 +103,7 @@ Generated code uses native language constructs:
- C#: Classes with `[ForyObject]` and registration helpers
- JavaScript: Interfaces with registration function
- Swift: `@ForyObject` models with `@ForyField` metadata and registration
helpers
+- Dart: `@ForyStruct` classes with `@ForyField` annotations and registration
helpers
## Quick Start
@@ -140,7 +141,7 @@ message Person {
foryc example.fdl --output ./generated
# Generate for specific languages
-foryc example.fdl --lang java,python,csharp,javascript,swift --output
./generated
+foryc example.fdl --lang java,python,csharp,javascript,swift,dart --output
./generated
```
### 4. Use Generated Code
@@ -195,11 +196,11 @@ message Example {
Fory IDL types map to native types in each language:
-| Fory IDL Type | Java | Python | Go | Rust | C++
| C# | JavaScript | Swift |
-| ------------- | --------- | -------------- | -------- | -------- |
------------- | -------- | ---------- | -------- |
-| `int32` | `int` | `pyfory.int32` | `int32` | `i32` | `int32_t`
| `int` | `number` | `Int32` |
-| `string` | `String` | `str` | `string` | `String` |
`std::string` | `string` | `string` | `String` |
-| `bool` | `boolean` | `bool` | `bool` | `bool` | `bool`
| `bool` | `boolean` | `Bool` |
+| Fory IDL Type | Java | Python | Go | Rust | C++
| C# | JavaScript | Swift | Dart |
+| ------------- | --------- | -------------- | -------- | -------- |
------------- | -------- | ---------- | -------- | -------- |
+| `int32` | `int` | `pyfory.int32` | `int32` | `i32` | `int32_t`
| `int` | `number` | `Int32` | `Int32` |
+| `string` | `String` | `str` | `string` | `String` |
`std::string` | `string` | `string` | `String` | `String` |
+| `bool` | `boolean` | `bool` | `bool` | `bool` | `bool`
| `bool` | `boolean` | `Bool` | `bool` |
See [Type System](schema-idl.md#type-system) for complete mappings.
diff --git a/docs/compiler/schema-idl.md b/docs/compiler/schema-idl.md
index d94d6e536f..bffa4eb465 100644
--- a/docs/compiler/schema-idl.md
+++ b/docs/compiler/schema-idl.md
@@ -102,6 +102,7 @@ package com.example.models alias models_v1;
| C++ | Namespace (dots to `::`) |
| C# | Namespace |
| JavaScript | Module name (last segment) |
+| Dart | Library name (package segments) |
## File-Level Options
@@ -551,6 +552,7 @@ FDL does not support `option ...;` statements inside enum
bodies.
| Rust | `#[repr(i32)] enum Status { Unknown }` |
| C++ | `enum class Status : int32_t { ... }` |
| JavaScript | `export enum Status { UNKNOWN, ... }` |
+| Dart | `enum Status { unknown, active, ... }` |
### Enum Prefix Stripping
@@ -575,6 +577,7 @@ enum DeviceTier {
| Python | `UNKNOWN, TIER1, TIER2` | Scoped IntEnum |
| Go | `DeviceTierUnknown, DeviceTierTier1, ...` | Unscoped const |
| JavaScript | `UNKNOWN, TIER1, TIER2` | Scoped enum |
+| Dart | `unknown, tier1, tier2` | Scoped enum |
**Note:** The prefix is only stripped if the remainder is a valid identifier.
For example, `DEVICE_TIER_1` is kept unchanged because `1` is not a valid
identifier name.
@@ -652,6 +655,7 @@ message Person { // Auto-generated when
enable_auto_type_id = true
| Rust | Struct with `#[derive(ForyObject)]` |
| C++ | Struct with `FORY_STRUCT` macro |
| JavaScript | `export interface` declaration |
+| Dart | `@ForyStruct` `final class` |
Type IDs control cross-language registration for messages, unions, and enums.
See
[Type IDs](#type-ids) for auto-generation, aliases, and collision handling.
@@ -776,6 +780,7 @@ message OtherMessage {
| Rust | Nested modules (`search_response::Result`)
|
| C++ | Nested classes (`SearchResponse::Result`)
|
| JavaScript | Flat names (`Result`)
|
+| Dart | Flat classes with underscore (`SearchResponse_Result`)
|
**Note:** Go defaults to underscore-separated nested names; set `option
go_nested_type_style = "camelcase";` to use concatenated names. Rust emits
nested modules for nested types.
@@ -879,6 +884,7 @@ message User {
| Rust | `name: String` | `name: Option<String>`
|
| C++ | `std::string name` | `std::optional<std::string> name`
|
| JavaScript | `name: string` | `name?: string \| null`
|
+| Dart | `String name` | `String? email`
|
**Default Values:**
@@ -907,14 +913,15 @@ message Node {
**Generated Code:**
-| Language | Without `ref` | With `ref` |
-| ---------- | -------------- | ----------------------------------------- |
-| Java | `Node parent` | `Node parent` with `@ForyField(ref=true)` |
-| Python | `parent: Node` | `parent: Node = pyfory.field(ref=True)` |
-| Go | `Parent Node` | `Parent *Node` with `fory:"ref"` |
-| Rust | `parent: Node` | `parent: Arc<Node>` |
-| C++ | `Node parent` | `std::shared_ptr<Node> parent` |
-| JavaScript | `parent: Node` | `parent: Node` (no ref distinction) |
+| Language | Without `ref` | With `ref` |
+| ---------- | -------------- | ------------------------------------------ |
+| Java | `Node parent` | `Node parent` with `@ForyField(ref=true)` |
+| Python | `parent: Node` | `parent: Node = pyfory.field(ref=True)` |
+| Go | `Parent Node` | `Parent *Node` with `fory:"ref"` |
+| Rust | `parent: Node` | `parent: Arc<Node>` |
+| C++ | `Node parent` | `std::shared_ptr<Node> parent` |
+| JavaScript | `parent: Node` | `parent: Node` (no ref distinction) |
+| Dart | `Node parent` | `Node parent` with `@ForyField(ref: true)` |
Rust uses `Arc` by default; use `ref(thread_safe=false)` or `ref(weak=true)`
to customize pointer types. For protobuf option syntax, see
@@ -941,6 +948,7 @@ message Document {
| Rust | `Vec<String>` |
| C++ | `std::vector<std::string>` |
| JavaScript | `string[]` |
+| Dart | `List<String>` |
### Combining Modifiers
@@ -961,12 +969,12 @@ apply to elements. `repeated` is accepted as an alias for
`list`.
**List modifier mapping:**
-| Fory IDL | Java |
Python | Go | Rust
| C++ |
-| ----------------------- | ---------------------------------------------- |
--------------------------------------- | ----------------------- |
--------------------- | ----------------------------------------- |
-| `optional list<string>` | `List<String>` + `@ForyField(nullable = true)` |
`Optional[List[str]]` | `[]string` + `nullable` |
`Option<Vec<String>>` | `std::optional<std::vector<std::string>>` |
-| `list<optional string>` | `List<String>` (nullable elements) |
`List[Optional[str]]` | `[]*string` |
`Vec<Option<String>>` | `std::vector<std::optional<std::string>>` |
-| `ref list<User>` | `List<User>` + `@ForyField(ref = true)` |
`List[User]` + `pyfory.field(ref=True)` | `[]User` + `ref` |
`Arc<Vec<User>>` | `std::shared_ptr<std::vector<User>>` |
-| `list<ref User>` | `List<User>` |
`List[User]` | `[]*User` + `ref=false` |
`Vec<Arc<User>>` | `std::vector<std::shared_ptr<User>>` |
+| Fory IDL | Java |
Python | Go | Rust
| C++ | Dart
|
+| ----------------------- | ---------------------------------------------- |
--------------------------------------- | ----------------------- |
--------------------- | ----------------------------------------- |
---------------------------------------------------- |
+| `optional list<string>` | `List<String>` + `@ForyField(nullable = true)` |
`Optional[List[str]]` | `[]string` + `nullable` |
`Option<Vec<String>>` | `std::optional<std::vector<std::string>>` |
`List<String>?` |
+| `list<optional string>` | `List<String>` (nullable elements) |
`List[Optional[str]]` | `[]*string` |
`Vec<Option<String>>` | `std::vector<std::optional<std::string>>` |
`List<String?>` |
+| `ref list<User>` | `List<User>` + `@ForyField(ref = true)` |
`List[User]` + `pyfory.field(ref=True)` | `[]User` + `ref` |
`Arc<Vec<User>>` | `std::shared_ptr<std::vector<User>>` |
`List<User>` + `@ForyField(ref: true)` |
+| `list<ref User>` | `List<User>` |
`List[User]` | `[]*User` + `ref=false` |
`Vec<Arc<User>>` | `std::vector<std::shared_ptr<User>>` |
`List<User>` + `@ListType(element: ValueType.ref())` |
Use `ref(thread_safe=false)` in Fory IDL (or `[(fory).thread_safe_pointer =
false]` in protobuf)
to generate `Rc` instead of `Arc` in Rust.
@@ -1037,6 +1045,7 @@ collection behavior, and reference tracking (see
| Rust | `bool` | |
| C++ | `bool` | |
| JavaScript | `boolean` | |
+| Dart | `bool` | |
#### Integer Types
@@ -1051,12 +1060,12 @@ Fory IDL provides fixed-width signed integers (varint
encoding for 32/64-bit by
**Language Mapping (Signed):**
-| Fory IDL | Java | Python | Go | Rust | C++ |
JavaScript |
-| -------- | ------- | -------------- | ------- | ----- | --------- |
------------------ |
-| `int8` | `byte` | `pyfory.int8` | `int8` | `i8` | `int8_t` | `number`
|
-| `int16` | `short` | `pyfory.int16` | `int16` | `i16` | `int16_t` | `number`
|
-| `int32` | `int` | `pyfory.int32` | `int32` | `i32` | `int32_t` | `number`
|
-| `int64` | `long` | `pyfory.int64` | `int64` | `i64` | `int64_t` | `bigint
\| number` |
+| Fory IDL | Java | Python | Go | Rust | C++ |
JavaScript | Dart |
+| -------- | ------- | -------------- | ------- | ----- | --------- |
------------------ | ------- |
+| `int8` | `byte` | `pyfory.int8` | `int8` | `i8` | `int8_t` | `number`
| `Int8` |
+| `int16` | `short` | `pyfory.int16` | `int16` | `i16` | `int16_t` | `number`
| `Int16` |
+| `int32` | `int` | `pyfory.int32` | `int32` | `i32` | `int32_t` | `number`
| `Int32` |
+| `int64` | `long` | `pyfory.int64` | `int64` | `i64` | `int64_t` | `bigint
\| number` | `int` |
Fory IDL provides fixed-width unsigned integers (varint encoding for 32/64-bit
by default):
@@ -1069,12 +1078,12 @@ Fory IDL provides fixed-width unsigned integers (varint
encoding for 32/64-bit b
**Language Mapping (Unsigned):**
-| Fory IDL | Java | Python | Go | Rust | C++ |
JavaScript |
-| -------- | ------- | --------------- | -------- | ----- | ---------- |
------------------ |
-| `uint8` | `short` | `pyfory.uint8` | `uint8` | `u8` | `uint8_t` |
`number` |
-| `uint16` | `int` | `pyfory.uint16` | `uint16` | `u16` | `uint16_t` |
`number` |
-| `uint32` | `long` | `pyfory.uint32` | `uint32` | `u32` | `uint32_t` |
`number` |
-| `uint64` | `long` | `pyfory.uint64` | `uint64` | `u64` | `uint64_t` |
`bigint \| number` |
+| Fory IDL | Java | Python | Go | Rust | C++ |
JavaScript | Dart |
+| -------- | ------- | --------------- | -------- | ----- | ---------- |
------------------ | -------- |
+| `uint8` | `short` | `pyfory.uint8` | `uint8` | `u8` | `uint8_t` |
`number` | `UInt8` |
+| `uint16` | `int` | `pyfory.uint16` | `uint16` | `u16` | `uint16_t` |
`number` | `UInt16` |
+| `uint32` | `long` | `pyfory.uint32` | `uint32` | `u32` | `uint32_t` |
`number` | `UInt32` |
+| `uint64` | `long` | `pyfory.uint64` | `uint64` | `u64` | `uint64_t` |
`bigint \| number` | `int` |
#### Integer Encoding Variants
@@ -1099,10 +1108,10 @@ you need fixed-width or tagged encoding:
**Language Mapping:**
-| Fory IDL | Java | Python | Go | Rust | C++ |
JavaScript |
-| --------- | -------- | ---------------- | --------- | ----- | -------- |
---------- |
-| `float32` | `float` | `pyfory.float32` | `float32` | `f32` | `float` |
`number` |
-| `float64` | `double` | `pyfory.float64` | `float64` | `f64` | `double` |
`number` |
+| Fory IDL | Java | Python | Go | Rust | C++ |
JavaScript | Dart |
+| --------- | -------- | ---------------- | --------- | ----- | -------- |
---------- | --------- |
+| `float32` | `float` | `pyfory.float32` | `float32` | `f32` | `float` |
`number` | `Float32` |
+| `float64` | `double` | `pyfory.float64` | `float64` | `f64` | `double` |
`number` | `double` |
#### String Type
@@ -1114,6 +1123,7 @@ you need fixed-width or tagged encoding:
| Rust | `String` | Owned, heap-allocated |
| C++ | `std::string` | |
| JavaScript | `string` | |
+| Dart | `String` | |
#### Bytes Type
@@ -1125,6 +1135,7 @@ you need fixed-width or tagged encoding:
| Rust | `Vec<u8>` | |
| C++ | `std::vector<uint8_t>` | |
| JavaScript | `Uint8Array` | |
+| Dart | `Uint8List` | |
#### Temporal Types
@@ -1138,6 +1149,7 @@ you need fixed-width or tagged encoding:
| Rust | `chrono::NaiveDate` | Requires `chrono` crate |
| C++ | `fory::serialization::Date` | |
| JavaScript | `Date` | |
+| Dart | `LocalDate` | Fory package type |
##### Timestamp
@@ -1149,6 +1161,7 @@ you need fixed-width or tagged encoding:
| Rust | `chrono::NaiveDateTime` | Requires `chrono` crate |
| C++ | `fory::serialization::Timestamp` | |
| JavaScript | `Date` | |
+| Dart | `Timestamp` | Fory package type |
#### Any
@@ -1160,6 +1173,7 @@ you need fixed-width or tagged encoding:
| Rust | `Box<dyn Any>` | Runtime type written |
| C++ | `std::any` | Runtime type written |
| JavaScript | `any` | Runtime type written |
+| Dart | `Object?` | Runtime type written |
**Example:**
@@ -1189,6 +1203,7 @@ message Envelope [id=122] {
| Rust | `payload: Box<dyn Any>` |
| C++ | `std::any payload` |
| JavaScript | `payload: any` |
+| Dart | `Object? payload` |
**Notes:**
@@ -1239,10 +1254,10 @@ message Config {
**Language Mapping:**
-| Fory IDL | Java | Python | Go
| Rust | C++ |
JavaScript |
-| -------------------- | ---------------------- | ----------------- |
------------------ | ----------------------- | --------------------------------
| --------------------- |
-| `map<string, int32>` | `Map<String, Integer>` | `Dict[str, int]` |
`map[string]int32` | `HashMap<String, i32>` | `std::map<std::string, int32_t>`
| `Map<string, number>` |
-| `map<string, User>` | `Map<String, User>` | `Dict[str, User]` |
`map[string]User` | `HashMap<String, User>` | `std::map<std::string, User>`
| `Map<string, User>` |
+| Fory IDL | Java | Python | Go
| Rust | C++ |
JavaScript | Dart |
+| -------------------- | ---------------------- | ----------------- |
------------------ | ----------------------- | --------------------------------
| --------------------- | -------------------- |
+| `map<string, int32>` | `Map<String, Integer>` | `Dict[str, int]` |
`map[string]int32` | `HashMap<String, i32>` | `std::map<std::string, int32_t>`
| `Map<string, number>` | `Map<String, Int32>` |
+| `map<string, User>` | `Map<String, User>` | `Dict[str, User]` |
`map[string]User` | `HashMap<String, User>` | `std::map<std::string, User>`
| `Map<string, User>` | `Map<String, User>` |
**Key Type Restrictions:**
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]