moshaf_boilerplate 1.0.0
moshaf_boilerplate: ^1.0.0 copied to clipboard
A CLI tool for generating Flutter boilerplate structures based on Clean Architecture, BLoC, dependencies, and more.
Flutter Boilerplate #
This repository provides a boilerplate source code to streamline the initial setup of new Flutter projects. Developed by moshafDEV, it ensures consistency, scalability, and adherence to best practices through Clean Architecture principles.
Features #
- Clean Architecture structure for maintainability and scalability
- Modular codebase for rapid development
- Pre-configured assets and essential directories
- Ready-to-use templates for common features
- Integrated support for multiple environments using
flutter_flavor
- State management with
flutter_bloc
- Dependency injection via
get_it
- Networking powered by
dio
- Local storage setup with
flutter_secure_storage
- Routing handled by
go_router
- Linting and code quality enforced with
flutter_lints
- Unit and widget testing configuration
- Customizable theme and localization support
- Error handling and logging modules
- Analytics integration for screen tracking
- Example implementation for authentication (login/profile)
- Separation of data, domain, and presentation layers
- Configurable environment variables and DI modules
Installation Guide #
Follow these steps to install moshaf_boilerplate
globally using Dart Pub:
-
Install Dart SDK
Ensure Dart SDK is installed on your system.
Refer to the official guide: dart.dev/get-dart. -
Open Terminal or Command Prompt
Use your preferred terminal (Linux/Mac) or Command Prompt (Windows). -
Run Installation Command
Execute the following command to installmoshaf_boilerplate
globally:dart pub global activate moshaf_boilerplate
-
Verify Installation
Confirm the installation by running:moshaf_boilerplate --help
If help information is displayed, the installation was successful.
-
Add Dart Pub Global Path (if required)
If the command is not recognized, add Dart's global pub path to your environment variables:- Linux/Mac:
$HOME/.pub-cache/bin
- Windows:
%USERPROFILE%\.pub-cache\bin
Example for Linux/Mac:
export PATH="$PATH:$HOME/.pub-cache/bin"
- Linux/Mac:
Usage Guide #
Once installation is complete, follow these steps to initialize your Flutter project using moshaf_boilerplate
:
-
Open CLI in Your Project Directory
Navigate to the folder where you want to create your new Flutter project. -
Run the Boilerplate Creation Command
Execute the following command:moshaf_boilerplate create
This will scaffold your project with the recommended structure and templates.
Note:
After generating your project, it is highly recommended to review and customize your.gitignore
file to ensure that unnecessary files and directories are excluded from version control. This helps maintain a clean repository and prevents accidental commits of sensitive or build-related files.
Directory Structure Overview #
Note: The following diagram illustrates the recommended folder structure, demonstrating clear separation of concerns in accordance with Clean Architecture.
├── assets
│ ├── animations
│ ├── fonts
│ ├── icons
│ ├── images
│ ├── svg
│ └── translations
├── build.yaml
├── config.json
├── lib
│ ├── app.dart
│ ├── core
│ │ ├── analytics
│ │ │ └── screen_analytics
│ │ ├── config
│ │ │ ├── di_module
│ │ │ └── loggers
│ │ ├── constants
│ │ ├── env
│ │ ├── error
│ │ ├── http_client
│ │ │ ├── interceptors
│ │ ├── routes
│ │ ├── services
│ │ └── utils
│ ├── data
│ │ ├── datasources
│ │ │ ├── local
│ │ │ └── remote
│ │ ├── models
│ │ │ ├── login
│ │ │ │ ├── request
│ │ │ │ └── response
│ │ │ └── profile
│ │ │ └── response
│ │ └── repository_impls
│ ├── domain
│ │ ├── entities
│ │ │ ├── auth
│ │ │ ├── login_param
│ │ │ ├── profile
│ │ │ └── text_input_field
│ │ ├── repositories
│ │ └── usecase
│ │ └── login
│ └── presentation
│ ├── bloc
│ │ └── login
│ ├── component
│ └── pages
│ ├── home
│ │ ├── components
│ ├── login
│ │ ├── components
│ ├── splash_screen
│ │ ├── components
│ └── welcome
│ ├── components
Recommended Versions #
For best compatibility and performance, use the following versions:
-
Flutter: 3.32.2
Check your version:flutter --version
-
Dart:
Check your version:dart --version
Refer to the official Dart installation guide: https://dart.cn/get-dart.
After installation, ensure the Dart SDK path is added to your system's environment variables.
Example for macOS/Linux:
export PATH="$PATH:/usr/local/bin/dart"
On Windows, add the Dart SDK path (e.g., C:\tools\dart-sdk\bin
) to your system's PATH variable.