simdjson_flutter

May 12, 2026 · View on GitHub

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 typeDart type
objectMap<String, dynamic>
arrayList<dynamic>
stringString
integerint
floatdouble
true / falsebool
nullnull

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

PlatformMinimum version
AndroidAPI 21
iOS12.0
macOS10.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