Giter Site home page Giter Site logo

ilisium-tech / flutter_clean_arch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from uuttssaavv/flutter_clean_arch

0.0 0.0 0.0 292 KB

Clean architecture in flutter using flutter_bloc as a reactive programming

Home Page: https://theutsavg1.medium.com/clean-architecture-in-flutter-8aadab851047

License: MIT License

Ruby 1.06% Objective-C 0.03% Kotlin 0.10% Dart 98.48% Swift 0.32%

flutter_clean_arch's Introduction

Flutter Clean Architecture

A simple flutter app based on Reso Coder's tutorial but implemented using feature-driven architecture.

What is used in this project?

  • Flutter bloc To implement the BLoC (Business Logic Component) design pattern.
  • Freezed Code generation for data classes
  • Get it Service location used as dependency injection
  • Dartz Functional Programming Either<Left,Right>
  • Auto Route Navigation package that uses code generation to simplify route setup
  • Dio Http client for dart. Supports interceptors and global configurations
  • Shared Preferences Persistent storage for simple data
  • Flutter and Dart And obviously flutter and dart ๐Ÿ˜…

Project Description

Data

The data layer is the outermost layer of the application and is responsible for communicating with the server-side or a local database and data management logic. It also contains repository implementations.

1. Data Source

Describes the process of acquiring and updating the data. Consist of remote and local Data Sources. Remote Data Source will perform HTTP requests on the API. At the same time, local Data sources will cache or persist data.

2. Models

An entity will depend on the data acquired from the different data sources. Serialization of JSON structure into Dart maps Entity objects to Models and vice-versa.

3. Repository

The bridge between the Data layer and the Domain layer. Actual implementations of the repositories in the Domain layer. Repositories are responsible for coordinating data from the different Data Sources.

Domain

The domain layer is responsible for all the business logic. It is written purely in Dart without flutter elements because the domain should only be concerned with the business logic of the application, not with the implementation details.

a. Use Cases

Describes the logic processing required for the application. Communicates directly with the repositories.

b. Repositories

Abstract classes that define the expected functionality of outer layers.

c. Entities

Business objects of the application. An entity will not depend on the data acquired from the server side.

Presentation

The presentation layer is the most framework-dependent layer. It is responsible for all the UI and handling the events in the UI. It does not contain any business logic.

a. Widget (Screens/Views)

Widgets notify the events and listen to the states emitted from the Bloc.

b. BloC

Receive the events from the views and interact with use cases accordingly. Emit the state according to the data received from the use cases. Bloc does not know about the view at all. It communicates in the form of states and events only.

Run this project

Clone this repository

git clone https://github.com/Uuttssaavv/flutter_clean_arch

Go to the project directory

cd flutter_clean_arch

Get all the packages

flutter pub get

Run the build runner command

flutter pub run build_runner build

Run the integration tests

flutter drive \ --driver=test_driver/integration_test.dart \ --target=integration_test/app_test.dart

Run the project

flutter run or simply press F5 key if you are using VSCode

About Me

Do visit my portfolio site or connect with me on linkedin

flutter_clean_arch's People

Contributors

uuttssaavv avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.