🎯 Dart Data Class Generator
Create Dart data classes quickly without writing boilerplate or running code generation.

✨ Features
Generate complete data classes with:
- ✅ Constructor with optional default values
- ✅ copyWith method for immutable updates
- ✅ toString method for debugging
- ✅ toJson/fromJson methods for serialization
- ✅ operator== and hashCode for value equality
- ✅ Equatable integration support
🚀 Getting Started
📝 Generate from Class Properties

⚡ Quick Fix (Single Class)
- 📄 Create a class with properties
- 🎯 Place cursor on class name, constructor, or field
- ⌨️ Press
Ctrl + . (or Cmd + . on macOS)
- ✨ Select desired generation option
🔧 Command (Multiple Classes)
- ⌨️ Press
Ctrl + P (or Cmd + P on macOS)
- 🔍 Search for "Dart Data Class Generator: Generate from class properties"
- ✅ Select classes to generate when prompted
💡 Tip: You can run the generator on existing data classes to update them after property changes.
🔄 Generate from JSON (Beta)

- 📄 Create an empty Dart file
- 📋 Paste raw JSON into the file
- ⌨️ Press
Ctrl + P (or Cmd + P on macOS)
- 🔍 Search for "Dart Data Class Generator: Generate from JSON"
- ✏️ Enter name for the root class
- 📂 Choose whether to separate nested classes into multiple files
⚠️ Beta Warning: Numbers in JSON might be interpreted as int even if they should be double.
🏷️ Working with Enums
To ensure enums are correctly serialized, annotate them:
// enum
final Enum myEnum;
🎁 Additional Features
The extension includes some additional quick fixes that might be useful to you:
📦 Import Refactoring
Sort imports alphabetically and bring them into the correct format easily.
⚙️ Settings
Customize the generator to only generate the functions you want in your settings file:
🔧 General Settings
| Setting |
Description |
Default |
quick_fixes |
Enable quick fixes for data class generation |
true |
json.key_format |
Format for JSON keys (variable, camelCase, snake_case) |
variable |
json.seperate |
How to handle nested JSON (ask, seperate, current_file) |
ask |
override.manual |
Ask before overriding each method |
false |
useEquatable |
Use Equatable for value equality |
false |
final_class.enabled |
Generate classes with final class keyword |
false |
🏗️ Constructor Settings
| Setting |
Description |
Default |
constructor.enabled |
Generate constructor |
true |
constructor.default_values |
Add default values to constructor |
false |
constructor.required |
Add @required annotation to parameters |
false |
🔄 Method Generation Settings
| Setting |
Description |
Default |
copyWith.enabled |
Generate copyWith method |
true |
toString.enabled |
Generate toString method |
true |
equality.enabled |
Generate == operator |
true |
hashCode.enabled |
Generate hashCode method |
true |
hashCode.use_jenkins |
Use Jenkins SMI hash function |
false |
📦 JSON Serialization Settings
| Setting |
Description |
Default |
toJson.enabled |
Generate toJson method |
true |
fromJson.enabled |
Generate fromJson method |
true |
fromJson.default_values |
Add default values in fromJson |
false |
| |