sinar12

pub package License: MIT

A powerful CLI tool designed to accelerate Flutter application development by standardizing project architecture and automating module scaffolding, specifically optimized for Riverpod state management and Dio networking.


🚀 Features

  • ✅ Project Scaffolding: Quickly generate a standardized Flutter project structure, complete with a robust core networking service setup.
  • 📦 Module Generation: Automatically scaffold complete feature modules with a single command. Every module includes:
    • Data Models (with fromJson/toJson)
    • API Services (Dio-based)
    • Riverpod Providers (FutureProvider & StateNotifier)
    • UI Pages (List View & Create Form)
  • 🏗️ Clean Architecture: Enforces a clean separation between the data, service, and presentation layers.
  • 🛠️ Utility Functions: Includes built-in string manipulation (camelCase, capitalize) and file system utilities for developers.

📂 Standardized Architecture

Sinar12 enforces a predictable structure for your Flutter apps:

lib/
├── models/      # Data transfer objects and models
├── service/     # API services and networking logic (Dio)
├── riverpod/    # State management providers
├── pages/       # UI screens and feature pages
└── component/   # Reusable UI widgets

🏁 Getting Started

Activate the CLI globally using Dart:

dart pub global activate sinar12

Note: Ensure your global Dart packages path is correctly added to your system environment variables.


📖 Usage

1. Initialize Project Structure

Initialize the base architecture at the root of your newly created Flutter application:

sinar12 create project

This generates essential base directories and sets up a common_service.dart class pre-configured for handling CRUD HTTP requests with Dio.

2. Generate Modules

Whenever you need a new feature, use the module generator to ensure consistent architecture across your app.

sinar12 create module product

This will automatically scaffold:

  • lib/models/product_model.dart
  • lib/service/product_service.dart
  • lib/riverpod/product_provider.dart
  • lib/pages/product_page.dart

3. Parse Swagger (OAPI)

Automatically generate your entire API layer from a Swagger/OpenAPI URL:

sinar12 parsing model https://api.example.com/swagger.json

💻 Programmatic Example

You can also use the framework's utilities directly in your code:

import 'package:sinar12/sinar12.dart';

void main() {
  // Use utility functions
  print(camelCase('my_snake_case_string')); // mySnakeCaseString
  print(capitalize('hello')); // Hello
  
  // Create directories and files
  createDirectory('temp/test');
  createFile('temp/test/hello.txt', 'Hello World!');
}

🤝 Contributing

For bug reports, feature requests, and contributions, please visit our GitHub Repository.


📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

Libraries

sinar12
A powerful CLI tool and framework for generating Sinar12 Flutter architecture.