Skip to content

egemenmede/flutter_template_repository

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flutter Template Repository

A Flutter Template Repository project.

Features of Template Repository

  • Clean Architecture (See Uncle Bob Martin)
  • State Management (BLoC - Recommended by Google Developers) (BLoC (Business Logic Component) is a state management pattern used in Flutter to separate the presentation layer from the business logic.)
  • etc. (TODO)

Packages Used

Layers Used

  • Core Layer

    It is the layer that belongs to the basic components to be used in the application. You can view the "Folder Structure" title for details. animation, routes, themes etc.

  • Data Layer

    Data Layer contains Repository Implementations (repositories) and multiple "datasources" (local, remote etc.). Repositories are responsible to coordinate data from the different Data Sources. Data Layer depends on Domain Layer.

    • datasources: The data sources to receive or store the application data. (See TODO)
    • models: Models should be a subclass of the relevant entity (domain layer). (With fromJson) (See TODO)
    • respositories: Contains the Repository Implementations of the data layer. (See TODO)
  • Domain Layer:

    The basic area of Clean Architecture and Domain-Driven Design is Domain Layer. All Business and Application Rules are determined here. There are no concrete classes because of the layer that determines the rules. In this way, they work independently of infrastructure and Frameworks. Because the domain layer is responsible for encapsulation of the business logic, it is particularly used to remove complexity and support reusability. No dependencies with other layers.

    • entities: The "repositories" under the Domain layer contain the entities of the rules set with the abstract methods. These entities will also be used by extending to the creation of models under the Data layer. (Without fromJson) (See TODO)
      • Naming conventions: Names should be in UpperCamelCase
    • repositories: Rest API/GraphQL etc. abstract methods. (See TODO)
    • usecases: The application is the area where business rules are identified. (See TODO)
  • Presenatation Layer

    Presentation Layer contains UI that is coordinated by Presenters which execute one or multiple Use cases. Presentation Layer depends on Domain Layer.

    • blocs: TODO (See TODO)
    • views: TODO (See TODO)
    • widgets: TODO (See TODO)

File Templates for Data Layer

class EntityModel extends Entity{
  EntityModel({
    String? value,}){
    _value = value;
  }

  EntityModel.fromJson(dynamic json) {
    _value = json['value'];
  }
  String? _value;

  @override
  String? get value => _value;

  Map<String, dynamic> toJson() {
    final map = <String, dynamic>{};
    map['value'] = _value;
    return map;
  }
}

File Templates for Domain Layer

class Entity {
  final String? value;

  const Entity({
    this.value,
  });
}
  • Repository File Template (domain>repositories>..) Example File
abstract class RepoNameRepository {
  //Future<ModelName> getModelData(String value);
  Future<String> getData(String value);
  Future<bool> getStatus(String check);
}

Folder Structure

Flutter app core folder structure

├── ...
├── lib                     	# Flutter project root
│   └── app                 	# Source of project
│   	├── core              	# Project core functionalities
│   	│   ├── animation       # 
│   	│   ├── routes          # 
│   	│   ├── themes          # 
│   	│   ├── usecase         # 
│   	│   ├── utils           # 
│   	│   └── ...             # etc.
│   	├── data                # All data files/folders
│   	│   ├── datasources     # 
│   	│   ├── models          # 
│   	│   └── repositories    # 
│   	├── domain              # All domain files/folders
│   	│   ├── entities        # 
│   	│   ├── repositories    # 
│   	│   └── usecases        # 
│   	├── presentation        # All presentation files/folders
│   	│   ├── blocs           # 
│   	│   ├── views           # 
│   	│   └── widgets         # 
│   	├── main.dart           # Start point
│   	└── ...                 # etc.
└── ...

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published