Skip to main content

simdjson_flutter 0.0.1 copy "simdjson_flutter: ^0.0.1" to clipboard
simdjson_flutter: ^0.0.1 copied to clipboard

Fast JSON encoding and decoding powered by simdjson (SIMD-accelerated).

Pub Version Platforms License

simdjson_flutter #

Flutter/Dart bindings for the simdjson project, a SIMD-accelerated JSON parser. If SIMD instructions are unavailable a fallback parser is used, making simdjson_flutter safe to use anywhere.

Supports Android, iOS, macOS, Windows, and Linux. Bundles simdjson v4.6.4 — no separate native install required.

Installation #

dependencies:
  simdjson_flutter: ^0.0.1

Usage #

The API is a drop-in replacement for dart:convert. Import the package and call jsonDecode / jsonEncode exactly as you would today:

import 'package:simdjson_flutter/simdjson_flutter.dart' as simdjson;

// Decode
final data = simdjson.jsonDecode('{"name":"simdjson","version":4,"fast":true}');
print(data['name']);    // simdjson
print(data['version']); // 4

// Encode
final json = simdjson.jsonEncode({
  'library': 'simdjson_flutter',
  'simd': true,
  'numbers': [1, 2, 3.14],
  'nested': {'key': 'value', 'nothing': null},
});
print(json);
// {"library":"simdjson_flutter","simd":true,"numbers":[1,2,3.14],...}

// Round-trip
final roundtripped = simdjson.jsonDecode(json) as Map<String, dynamic>;

Type mapping #

JSON type Dart type
object Map<String, dynamic>
array List<dynamic>
string String
integer int
float double
true / false bool
null null

jsonDecode throws a FormatException on invalid JSON. jsonEncode throws an ArgumentError for unsupported types. double values NaN and Infinity are encoded as null per the JSON spec.

Platform support #

Platform Minimum version
Android API 21
iOS 12.0
macOS 10.14
Windows —
Linux —

All platforms use C++17 and invoke native code directly via Dart FFI — no method channels.

Benchmarks #

Comparative benchmarks against dart:convert and other libraries are tracked in the benchmarks directory.

Building #

The vendored simdjson amalgamation (src/vendor/simdjson.h / src/vendor/simdjson.cpp) is built automatically by the Flutter toolchain on every platform. No extra setup is needed.

To regenerate the FFI bindings after modifying src/simdjson_flutter.h:

dart run ffigen --config ffigen.yaml

simdjson-dart #

simdjson-dart #

0
likes
150
points
8
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Fast JSON encoding and decoding powered by simdjson (SIMD-accelerated).

License

MIT (license)

Dependencies

ffi, flutter, plugin_platform_interface

More

Packages that depend on simdjson_flutter

Packages that implement simdjson_flutter