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.
dependencies:
simdjson_flutter: ^0.0.1The 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>;| 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 | 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.
Comparative benchmarks against dart:convert and other libraries are tracked
in the benchmarks directory.
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