Skip to content

Repository files navigation

neuma-api-header

✨ What is Neuma API Flutter?

Neuma API Flutter is a powerful VS Code extension designed to simplify your Flutter backend integration process by automatically creating folders and Dart files for you.

This extension is suitable for any Dart project. Although it is made to pair seamlessly with Neuma Base Flutter, this tool allows you to generate Dart models instantly from JSON.

Whether you’re building requests or parsing responses, Neuma API Flutter keeps your workflow rapid, consistent, and efficient.

💡 Features

  • 🤖 Generate Dart models with one command
  • 📁 Automatically create and manage folders
  • 🧠 Smart type inference with nested class generation
  • 📦 Support for arrays and objects of any depth
  • 🎯 Choose between Request or Response generation
  • 🔧 Additional configurations for custom folders and generation settings

🚀 Getting Started

1. Install the Extension

Download the latest .vsix file from the Releases page.

Then install via CLI:

code --install-extension neuma-api-flutter-x.x.x.vsix

Or install it from VS Code:

  1. Open VS Code
  2. Press Ctrl+Shift+P (or Cmd+Shift+P on MacOS)
  3. Type >Extensions: Install from VSIX
  4. Select the downloaded .vsix file

2. Use the Command

Press Cmd+Shift+P (Mac) or Ctrl+Shift+P (Windows/Linux), then run:

Neuma API: Convert JSON to Dart Model

You will be prompted to:

  • Paste your JSON
  • Choose Request or Response
  • Enter a class name

The Dart model is automatically generated and copied to your clipboard! 🥳✨

📄 Example: Input & Output

🔁 Response Input

{
"id": 42,
"title": "Sample Post",
"author": {
"id": 1,
"name": "Jane Doe"
},
"tags": ["flutter", "dart"]
}

✅ Generated Dart (Response)

classSampleResponse {
finalint id;
finalString title;
finalSampleAuthorResponse author;
finalList<String> tags;
constSampleResponse({
requiredthis.id,
requiredthis.title,
requiredthis.author,
requiredthis.tags,
});
factorySampleResponse.fromJson(Map<String, dynamic> json) {
returnSampleResponse(
id: json['id'],
title: json['title'],
author:SampleAuthorResponse.fromJson(json['author']),
tags:List<String>.from(json['tags']),
);
}
}
classSampleAuthorResponse {
finalint id;
finalString name;
constSampleAuthorResponse({
requiredthis.id,
requiredthis.name,
});
factorySampleAuthorResponse.fromJson(Map<String, dynamic> json) {
returnSampleAuthorResponse(
id: json['id'],
name: json['name'],
);
}
}

📤 Request Input

{
"title": "Create New Post",
"body": "This is the body of the new post",
"tags": ["flutter", "api"]
}

✅ Generated Dart (Request)

classCreatePostRequest {
finalString title;
finalString body;
finalList<String> tags;
constCreatePostRequest({
requiredthis.title,
requiredthis.body,
requiredthis.tags,
});
Map<String, dynamic> toJson() {
return {
'title': title,
'body': body,
'tags': tags,
};
}
}

📁 Folder Structure

📁 lib/
├── 📁 models/
│ ├── 📁 create_post/
│ │ ├── create_post_request.dart
│ │ ├── create_post_response.dart
│ │── 📁 sample/
│ │ ├── sample_request.dart
│ │ ├── sample_response.dart

⚙️ Configuration Options

You can customize how the extension generates your Dart models via the VS Code settings UI by searching for Neuma API Flutter. Below are the available options:

🔧 General Settings

SettingDescriptionDefault
Add Part StatementAdds part 'file.g.dart'; for code generation compatibility.false
Default Base FolderBase path where models will be generated.lib/data/models
Field CaseControls naming style of fields. Options: camelCase, snake_case, or original.camelCase

🧱 Model Structure

SettingDescriptionDefault
Generate Copy WithAdds a copyWith() method to generated classes.false
Generate EquatableExtends Equatable for value equality (requires equatable package).false
Generate JSON AnnotationAdds @JsonKey() decorators (requires json_annotation).false
Generate SubfoldersOrganizes output into subfolders per class name.true
Generate To StringAdds a toString() override.false

🛡️ Safety & Advanced

SettingDescriptionDefault
Null SafetyHandles nullability: nullable, non-nullable, or auto.auto
Use FreezedUses the freezed package instead of regular classes.false

Or add it directly in your settings.json:

{
"neuma-api-flutter.defaultBaseFolder": "lib/data/models",
"neuma-api-flutter.fieldCase": "camelCase",
"neuma-api-flutter.generateCopyWith": true,
...
}

🛠️ Future Plans

  • ✅ Custom generation folder location
  • ✅ Optional settings for copyWith(), Equatable, Freezed, etc
  • ⏳ Convert from Postman or Swagger JSON collection

📄 License

Licensed under the MIT License

About

A powerful VS Code extension designed to simplify your Flutter backend integration process by automatically creating folders and Dart files from JSON.

Topics

Resources

Stars

5 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages