Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 1.33 KB

README.md

File metadata and controls

40 lines (30 loc) · 1.33 KB

This example assumes you're using a recent version of the Dart or Flutter SDK.

To use package:json_serializable in your package, add these dependencies to your pubspec.yaml.

dependencies:
  json_annotation: ^3.0.0

dev_dependencies:
  build_runner: ^1.0.0
  json_serializable: ^3.2.0

Annotate your code with classes defined in package:json_annotation.

Run pub run build_runner build to generate files into your source directory.

> pub run build_runner build
[INFO] ensureBuildScript: Generating build script completed, took 368ms
[INFO] BuildDefinition: Reading cached asset graph completed, took 54ms
[INFO] BuildDefinition: Checking for updates since last build completed, took 663ms
[INFO] Build: Running build completed, took 10ms
[INFO] Build: Caching finalized dependency graph completed, took 44ms
[INFO] Build: Succeeded after 4687ms with 1 outputs

NOTE: If you're using Flutter, replace pub run with flutter packages pub run.