safe_json_annotation

pub package license: MIT

Runtime companion for safe_json_serializable — the tolerant parse helpers (safeInt, safeString, …) that its generated code calls, plus a re-export of json_annotation so this is the only serialization import your models need.

Add it to your dependencies and see the safe_json_serializable README for full setup and behaviour.

dependencies:
  safe_json_annotation: ^0.2.2

dev_dependencies:
  safe_json_serializable: ^0.3.0
  build_runner: ^2.4.0
import 'package:safe_json_annotation/safe_json_annotation.dart';

part 'user.g.dart';

@JsonSerializable()
class User { /* … */ }

License

MIT — see LICENSE.

Libraries

safe_json_annotation
Runtime side: the tolerant parsers the generated code calls. Import this in your model files (it also re-exports json_annotation).