Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>Dart Class ForgeNew to Visual Studio Code? Get it now.
Dart Class Forge

Dart Class Forge

Taha Darwish

|
270 installs
| (1) | Free
Smart Dart data class toolkit with JSON-to-class conversion, clipboard generation, auto date detection, Equatable/Mixin support, empty factories, example lists, and 12+ inline quick fixes.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Dart Class Forge

Dart Class Forge

A smart VS Code toolkit for generating production-ready Dart data classes. Go from properties or raw JSON to fully equipped classes — with constructors, serialization, equality, and more — in seconds.

VS Code

Why Dart Class Forge?

Dart Class Forge goes beyond basic code generation. It understands your project context — detecting Flutter vs pure Dart, handling part of files, preserving your coding style, and offering 12+ targeted quick fixes so you generate exactly what you need.

Key differentiators:

  • Clipboard-based JSON-to-class conversion (no temp files needed)
  • Automatic ISO 8601 date detection in JSON — DateTime fields are inferred for you
  • Smart numeric array inference ([1, 2, 3.5] correctly becomes List<double>)
  • factory ClassName.empty() generator for form initialization patterns
  • Static example list generator with type-aware sample data
  • Both Equatable and EquatableMixin support (for classes with existing superclasses)
  • final class keyword support for Dart 3.0+ sealed hierarchies
  • Intelligent import organization: groups dart, package, local, and relative imports separately
  • Flutter project auto-detection via pubspec.yaml
  • Widget/State class awareness — never generates data class methods on UI classes

Quick Start

From Class Properties

Single class (Quick Fix):

  1. Write a class with properties in a .dart file
  2. Place your cursor on the class name, constructor, or any field
  3. Press Ctrl + . (or Cmd + . on macOS) to open quick fixes
  4. Pick the generation option you need

Multiple classes (Command Palette):

  1. Press Ctrl + Shift + P (or Cmd + Shift + P on macOS)
  2. Run "Dart Class Forge: Generate from class properties"
  3. Select which classes to process

You can re-run the generator on existing data classes after changing properties to update all methods.

From JSON (File)

  1. Create an empty .dart file and paste raw JSON into it
  2. Open the Command Palette and run "Dart Class Forge: Generate from JSON"
  3. Enter a name for the root class
  4. Choose whether to split nested classes into separate files

From JSON (Clipboard)

  1. Copy JSON to your clipboard
  2. Open any .dart file
  3. Run "Dart Class Forge: Generate from Clipboard" from the Command Palette
  4. Enter a name for the root class

Smart JSON features:

  • Date strings like "2024-01-18T12:00:00Z" become DateTime fields automatically
  • Mixed numeric arrays like [1, 2, 3.5] correctly infer double
  • Nested objects generate separate classes with proper references

Enum Handling

Annotate enum fields so serialization works correctly:

// enum
final Enum myEnum;

Available Quick Fixes

Place your cursor on a class and press Ctrl + . to access these actions:

Quick Fix Description
Generate Data Class Full generation (constructor + all methods)
Generate Constructor Smart constructor with const inference
Generate copyWith Immutable update method
Generate JSON Serialization Both toJson and fromJson together
Generate toJson Serialization to Map
Generate fromJson Deserialization from Map
Generate toString Debug-friendly string representation
Generate Equality == operator and hashCode
Generate Equatable Equatable-based equality
Generate Empty Factory factory ClassName.empty() for forms
Generate Example List Static list of 10 sample items
Organize Imports Sort and group imports properly

Import Organization

The import organizer groups and sorts your imports into a clean structure:

  1. dart: core libraries
  2. package: third-party dependencies
  3. Local package imports (same project)
  4. Relative imports
  5. part / export statements

Each group is separated by a blank line and sorted alphabetically.

Settings

All settings use the prefix dart_class_forge. in your VS Code settings.

General

Setting Description Default
quick_fixes Enable inline quick fix actions true
json.key_format JSON key format: variable, camelCase, snake_case variable
json.separate Nested JSON handling: ask, separate, current_file ask
json.detect_dates Auto-detect ISO 8601 strings as DateTime true
override.manual Confirm before overriding each method individually false
useEquatable Use Equatable for value equality false
useEquatableMixin Use EquatableMixin instead of extending Equatable false
final_class.enabled Generate with final class keyword (Dart 3.0+) false

Constructor

Setting Description Default
constructor.enabled Generate constructor true
constructor.default_values Add default values to constructor parameters false
constructor.required Add required keyword to all named parameters false

Methods

Setting Description Default
copyWith.enabled Generate copyWith method true
toString.enabled Generate toString method true
equality.enabled Generate == operator true
hashCode.enabled Generate hashCode true
hashCode.use_jenkins Use Jenkins SMI hash function false

JSON Serialization

Setting Description Default
toJson.enabled Generate toJson method true
fromJson.enabled Generate fromJson method true
fromJson.default_values Add default values for optional params in fromJson false

Additional Generators

Setting Description Default
emptyFactory.enabled Generate factory ClassName.empty() false
exampleList.enabled Generate static example list with 10 items false

License

MIT License.


Built by Taha Darwish

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft