Skip to content

chunlee-thong/dart-quicktype

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1d22bf3 · Mar 14, 2023

History

92 Commits
Jun 23, 2022
Mar 13, 2023
Mar 14, 2023
Mar 14, 2023
Jun 5, 2021
Apr 4, 2022
Mar 14, 2023
Mar 14, 2023
Mar 13, 2023
Mar 13, 2023
Mar 14, 2023
Jun 5, 2021
Apr 4, 2022

Repository files navigation

Dart QuickType

version: 2.5.1

A custom implemenation of JSON to Dart model class from QuickType.

Netlify Status

Site variation

This project is configure to fit my use case only so the default behavior will be:

  • All fields are final
  • All fields are required
  • Has an option to generate toJSON,copyWith and toString
  • support Equatable and JsonSerialize
  • No freezed or hive

Type setting

When Dart class is generated from json, nullable or non-nullable field are define below.

Type Nullable default value
String setting ""
bool setting false
int setting 0
double setting 0
Array never []
Object always null
DateTime always null
  • Array can never be null
  • Object and DateTime always nullable
  • Other types can configure with checkbox setting

Customize for your use case

  • edit Dart's quicktype config in custom_dart_renderer.ts
  • run npm run build to build from ts to vanilla js
  • test your change in index.html