json_serializable_lints

Small analysis server plugin with focused lints for json_serializable models.

Rules

  • require_json_serializable_from_json
    Requires factory ClassName.fromJson(Map<String, dynamic> json) on @JsonSerializable() classes.
  • require_json_serializable_to_json
    Requires Map<String, dynamic> toJson() on @JsonSerializable() classes.

These rules are skipped when you explicitly disable generation with createFactory: false or createToJson: false.

Usage

Add the package to your Dart or Flutter project:

# analysis_options.yaml
plugins:
  json_serializable_lints: any

Run analysis:

dart analyze

See examples for detailed options.

More info

Contributing

Contributions, issues, and pull requests are welcome.