GithubHelp home page GithubHelp logo

clean-flutter-manguinho's Introduction

clean_flutter_manguinho

This project is the follow on code of the course: "Flutter, TDD, Clean Architecture, SOLID e Design Patterns" by Rodrigo Manguinho.

Features

The app has the following features:

  • authentication ✅
  • show surveys ✅
  • show a single survey ✅
  • save survey answer [?]

Main goal of the project

Teach how to use Clean architecture patterns on Flutter projects with Test Driven Development(TDD).

Folder architecture based on Clean Architecture

Domain folder

The domain folder in this project has 3 folders, and is responsible for the Domain layer in the Clean Architecture

entities helpers usecases
Has all entities definitions to be used in this app. In other words, these are the objects which Remote APIs DTOs should be mapped. In this app this is where the domain errors, i.e, the errors regarding the app domain, will be placed. The domain usecases folder have the blueprint of the usecases to be implemented throughout the app. They will be later implemented in the data/usecases files.

Data folder

The data folder in this project is responsible for the data layer in the Clean Architecture. Data Layer handles all data mutations and convertions to the application domain entities. It shoudl be common to find remote/local(offline) objects being mapped to entities. This ensures that the data the remote domain and the app domain are separated. Inside of the data folder, there can be multiple folders according to a specific feature that the app should have, for example, a http client, a cache manager, camera and others. These folders in a similar fashion as the domain usecases, will contain only abstract classes that will be implemented later by the infra layer.

cache http models usecases
Cache is used in this app for allowing offline features. Here we have definitions for each behavior the cache should have. In the http folder we have the definitions for http client features. Therefore, here we have the error definitions for http requests like bad request, not found and others. Here lives all the files for remote/local entities, i.e blueprints classes that should have mappers to the domain entities classes. The logic to "map to another class" should be inside of there. This way we can isolate the class properties if the remote domain changes. Usecases in the data layer have the implementations of the domain usecases folder. In other words, the data layer implementations will literally "implements" an interface or an abstract class which is points to a behavior required by the app.

Couple testing hints

Mock Should be used when you only want the returned value of a method/function, but it is not required to get the returned value inside of the test scope.

Spy A Spy is used when the developer needs to get the returned value and change it to mock for different situations.

Stub Test doubles or stubs are used to mock the returned value of something but it is not required to get this returned value inside the test scope. Mockar o resultado e não está interessado em capturar nada

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.