A powerful plugin for Android Studio and IntelliJ IDEA that automatically generates:
- Dart methods — copyWith, toJson, fromJson, toString
- Dart classes from JSON — paste JSON, get a complete class
- Barrel files — index.dart with organized exports
- copyWith() — creates modified copies of the class
- toJson() — serializes the class to a JSON map
- fromJson() — deserializes a class from a JSON map
- toString() — formatted multiline string representation
- Supports nullable types (
String?,int?, etc.) - Interactive dialog to choose individual methods
- Smart duplicate handling — the batch dialog warns and skips methods that already exist; individual actions replace the existing method in place
- Keyboard shortcut:
Ctrl+Alt+D(Windows/Linux) /Cmd+Alt+D(macOS)
- Paste any JSON object and generate a complete Dart class
- Nested objects generate separate, properly typed Dart classes
toJson()andfromJson()handle nested classes automatically- Choose which methods to include
- Auto-formats JSON on paste
- Keyboard shortcut:
Ctrl+Alt+J(Windows/Linux) /Cmd+Alt+J(macOS)
- Automatically exports all Dart files from a folder
- File list with checkboxes — choose exactly what to include
- Optional recursive mode for subdirectories
- Keyboard shortcut:
Ctrl+Alt+B(Windows/Linux) /Cmd+Alt+B(macOS)
- Build the plugin:
./gradlew buildPlugin - In Android Studio / IntelliJ IDEA: File → Settings → Plugins
- Click the gear icon → Install Plugin from Disk
- Select
build/distributions/dart-data-toolkit-1.2.0.zip - Restart the IDE
For detailed examples and advanced usage, see the Usage Guide.
class User {
final String name;
final String email;
final int? age;
User({
required this.name,
required this.email,
this.age,
});
}- Place the cursor inside the class
- Press
Ctrl+Alt+D/Cmd+Alt+D(or right-click → Dart Data Methods...) - Select the methods you want
- Code is inserted automatically
- Press
Ctrl+Alt+J/Cmd+Alt+Janywhere in a Dart file - Enter a class name (e.g.
User) - Paste your JSON (auto-formatted)
- Select which methods to include
- Click OK
{
"name": "Alice",
"email": "alice@example.com",
"age": 30
}Generates:
class User {
final String name;
final String email;
final int age;
User({
required this.name,
required this.email,
required this.age,
});
User copyWith({
String? name,
String? email,
int? age,
}) {
return User(
name: name ?? this.name,
email: email ?? this.email,
age: age ?? this.age,
);
}
Map<String, dynamic> toJson() {
return {
'name': name,
'email': email,
'age': age,
};
}
factory User.fromJson(Map<String, dynamic> json) {
return User(
name: json['name'],
email: json['email'],
age: json['age'],
);
}
@override
String toString() {
return '''
User(
name: $name,
email: $email,
age: $age,
)
''';
}
}Nested JSON objects are detected automatically — each becomes its own Dart class.
Given:
{
"name": "Alice",
"email": "alice@example.com",
"address": {
"street": "123 Main St",
"city": "Springfield"
}
}Two classes are generated: Address and User. User.toJson() calls address.toJson() and User.fromJson() calls Address.fromJson(json['address'] as Map<String, dynamic>).
- Right-click on a folder in the Project panel
- Press
Ctrl+Alt+B/Cmd+Alt+B(or Dart Barrel File...) - Choose files, enable recursive if needed
- Click OK —
folder.dartis created
class User {
final String name;
final String email;
final int? age;
User({
required this.name,
required this.email,
this.age,
});
}class User {
final String name;
final String email;
final int? age;
User({
required this.name,
required this.email,
this.age,
});
User copyWith({
String? name,
String? email,
int? age,
}) {
return User(
name: name ?? this.name,
email: email ?? this.email,
age: age ?? this.age,
);
}
Map<String, dynamic> toJson() {
return {
'name': name,
'email': email,
'age': age,
};
}
factory User.fromJson(Map<String, dynamic> json) {
return User(
name: json['name'],
email: json['email'],
age: json['age'],
);
}
@override
String toString() {
return '''
User(
name: $name,
email: $email,
age: $age,
)
''';
}
}src/main/kotlin/com/kxaca/dartdatatoolkit/
├── actions/
│ ├── GenerateDataClassAction.kt # Ctrl+Alt+D entry point
│ ├── GenerateMethodActions.kt # Individual method actions (Alt+Insert)
│ ├── JsonToDartAction.kt # Ctrl+Alt+J entry point
│ ├── GenerateBarrelFileAction.kt # Ctrl+Alt+B entry point
│ ├── ChooseMethodsDialog.kt
│ ├── JsonToDartDialog.kt
│ └── GenerateBarrelDialog.kt
├── generators/
│ ├── CopyWithGenerator.kt
│ ├── GeneratorsKit.kt # ToJson, FromJson, ToString
│ ├── JsonToDartGenerator.kt
│ └── BarrelFileGenerator.kt
└── parser/
└── DartClassParser.kt
Requirements: JDK 17+, Gradle 8.8 (pinned via wrapper)
./gradlew buildPlugin # produces build/distributions/dart-data-toolkit-1.2.0.zip
./gradlew runIde # launches a sandbox IDE with the plugin installedSee CONTRIBUTING.md for guidelines on reporting bugs, suggesting features, and submitting pull requests.
MIT License — see LICENSE for details.
Made with ❤️ for the Dart and Flutter community
The Flutter logo used in this plugin's icon is a trademark of Google LLC. It is used in accordance with the Flutter Brand Guidelines under the Creative Commons Attribution 4.0 International License. This plugin is not affiliated with or endorsed by Google or the Flutter team.
Also available in Português (pt-BR)