Skip to content

SunFoxx/clean-architecture-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vehicles catalog

This app serves as a testing assignment for Senior Flutter Developer position. It reaches out for public api to fetch the information about all known vehicles manufacturers if a form of infinite list and allows to request details about all makes of every individual manufacturer.

Installation

Prerequisites

– Dart 2.12.0 (Get from here)
– Flutter 2.5.1 (Get from here)

  1. install all the dependencies via:
    flutter pub get
  2. generate missing code snippets
    flutter pub run build_runner build

Structure

This app is designed with clean architecture. Generally it is separated into two folders

  • core – general purpose tools that can be used across the whole app, such as:
    • entities mostly for custom-made data structures
    • errors for unified error handling
    • localization that holds translatable strings
    • logger, which name speaks for itself
    • network provides the app with tools to interact with network-based data sources
    • theme that holds custom set of configurations and conventions for the visual elements
    • ubiquitous utils folder for helper functions
    • widgets ui-kit with set of commonly used visual building blocks
    • and most importantly, locator - service locator, a place, where all the dependencies are being injected, all instances and factories are being registered and the access to all of that is being shared
  • features - all the pieces of functionality, separated by their business domain. Since our app serves only two purposes, we have two features:
    • manufacturers - operates with manufacturers, defines how we load, process and display them.
    • makes - basically the same thing, but operates with makes

Unit-tests are mimicking the whole structure of the app

Every feature is presented with 3 loosely coupled layers: data, domain and presentation. They define the direction of data flow and serve different purposes

  • data layer includes logic of communication with the 'outer world' - databases, API's, cache, file system etc.
  • domain layer holds the pure business logic. Usually consists of abstractions and classes that operate those abstractions regardless of their implementations
  • presentation layer responsible, well, for presenting the app to the end user - rendering the UI, handling interactions with elements and navigation between screens

The data flows between these layers like this:

img

Domain doesn’t have any dependency on any other layer and mostly written with pure Dart with almost no external dependencies and frameworks. However, data and presentation layers are well-aware of domain layer, whereas they still have no idea about each other.

About

Demo flutter application designed with clean architecture to showcase the way of writing clean code

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published