https://github.com/chmoore889/isolate_json
Library for using a long-lived isolate for JSON encoding and decoding.
https://github.com/chmoore889/isolate_json
isolate json
Last synced: about 1 month ago
JSON representation
Library for using a long-lived isolate for JSON encoding and decoding.
- Host: GitHub
- URL: https://github.com/chmoore889/isolate_json
- Owner: chmoore889
- License: gpl-3.0
- Created: 2021-01-25T05:51:18.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-08-22T01:28:01.000Z (over 3 years ago)
- Last Synced: 2025-03-26T22:11:29.557Z (about 2 months ago)
- Topics: isolate, json
- Language: Dart
- Homepage: https://pub.dev/packages/isolate_json
- Size: 22.5 KB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
## Introduction
This is a library for using a long-lived isolate to encode and decode JSONs.When in a VM it uses isolates. This package is able to support web by falling back to encoding/decoding without isolates on web. This is so that an application using this package does not have to do that check itself.
## Usage
A simple usage example:
```dart
import 'package:isolate_json/isolate_json.dart';Future main() async {
await JsonIsolate().startIsolate();final json = '{"name":"John", "age":30, "car":null}';
final output1 = await JsonIsolate().decodeJson(json);final output2 = await JsonIsolate().encodeJson({
'jsonData': true,
});final output3 = await JsonIsolate().encodeJson([1, 2, 3]);
print(output1);
print(output2);
print(output3);JsonIsolate().dispose();
}
```## Features and bugs
Please file feature requests and bugs at the [issue tracker][tracker].
[tracker]: https://github.com/chmoore889/isolate_json/issues