Skip to content

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

License

Notifications You must be signed in to change notification settings

codeabelity/neuma-api-flutter

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

🚀 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)

class SampleResponse {
  final int id;
  final String title;
  final SampleAuthorResponse author;
  final List<String> tags;

  const SampleResponse({
    required this.id,
    required this.title,
    required this.author,
    required this.tags,
  });

  factory SampleResponse.fromJson(Map<String, dynamic> json) {
    return SampleResponse(
      id: json['id'],
      title: json['title'],
      author: SampleAuthorResponse.fromJson(json['author']),
      tags: List<String>.from(json['tags']),
    );
  }
}

class SampleAuthorResponse {
  final int id;
  final String name;

  const SampleAuthorResponse({
    required this.id,
    required this.name,
  });

  factory SampleAuthorResponse.fromJson(Map<String, dynamic> json) {
    return SampleAuthorResponse(
      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)

class CreatePostRequest {
  final String title;
  final String body;
  final List<String> tags;

  const CreatePostRequest({
    required this.title,
    required this.body,
    required this.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

🛠️ 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

License

Stars

Watchers

Forks