Bidev

Dart Data Class Generator

Paste JSON to generate an immutable Dart data class — constructor, copyWith, toString, and equality.

No fromJson/toJson here — for JSON (de)serialization, use the JSON to Dart Converter instead.

Generated Dart
// Click "Generate" to see the Dart class

Related Tools

// more about this tool

What makes a Dart class properly immutable

An immutable data class needs more than final fields. It needs a copyWith method so you can produce a modified copy without mutating the original (essential for state management patterns like Bloc or Riverpod, where state objects should never be mutated in place), a working == operator and hashCode so two instances with the same field values are treated as equal instead of only being equal by reference, and a readable toString for debugging. Writing all of that correctly by hand, especially the equality check across every field, is tedious and easy to get subtly wrong.

What this generates from your JSON

Paste a JSON sample and it produces a Dart class with typed final fields inferred from the JSON's actual values, a constructor, copyWith, a value-based == and hashCode covering every field, and toString. No fromJson/toJson serialization is included, since this tool is specifically for the immutable-class shape itself; pair it with the JSON to Dart converter if you also need serialization.