Skip to content

Latest commit

 

History

History
171 lines (103 loc) · 5.3 KB

File metadata and controls

171 lines (103 loc) · 5.3 KB

Software Architecture

Context

[Insert context description here]

[Create this diagram from the architecture file (context tab) using Draw.io]

Context diagram

Functional Overview

This is a summary of the functionalities available to the user.

[Insert list of functionalities here]

Application Structure

[Insert structure description here]

[Create this diagram from the architecture file (structure tab) using Draw.io]

Structure diagram

Solution Structure

The application solution is divided in 2 main areas.

Solution diagram

  • test contains the tests.
  • lib contains the shared code used by the application and the tests.
    • It's divided per application layer.

Access (DAL)

The data access layer is where you would put external dependencies such as API clients and local storage. Classes providing data should be suffixed with Repository. This is where you put serializable entities. The associated folder is named access (and not data_access) so that it shows as the first element alphabetically.

Business

The business layer is where you put your business services and entities that manipulate data from the data access layer. Classes providing business services should be suffixed with Service. Entities from the business layer are usually immutable and they don't need to be serializable.

Presentation

The presentation layer implements the user experience (UX) and the user interface (UI). It contains all the widgets and state management classes.

Technical Overview

General

Topics that apply to the whole application.

Dependency Injection

This application is designed to use dependency injection (DI) to manage dependencies between components.

See DependencyInjection.md for more details.

Diagnostics

This application contains a diagnostic overlay.

See Diagnostics.md for more details.

Logging

This application contains a built-in logging system that can be used to log messages to the debugger's console, to the native consoles, or to a file.

See Logging.md for more details.

Forced Update

This application contains a forced update feature.

See ForcedUpdate.md for more details.

Kill Switch

This application contains a kill switch feature.

See KillSwitch.md for more details.

Access (DAL)

Data access services (also referred to as repositories) are always declared using an interface and implemented in a separate class. These interfaces are meant to be used from the business layer.

HTTP Requests

See HTTP.md for more details.

Local Storage

This application uses Shared Preferences to store data locally.

JSON Serialization

See Serialization.md for more details.

Business

Business services are always declared using an interface and implemented in a separate class. These interfaces are meant to be used from the presentation layer and sometimes by other business services.

Presentation

Navigation

See Navigation.md for more details.

State Management

This application uses the MVVM pattern. The ViewModel class is used as a base class for all ViewModels. ViewModels have the concept of dynamic properties. These defined using accessors that call the get (or variants such as getLazy) and optionally set methods to automatically trigger widget rebuilds.

Here is an example of a ViewModel showcasing the usage of dynamic properties.

class HomePageViewModel extends ViewModel {
  // Regular properties don't trigger rebuild if changed.
  final String title = 'Flutter Demo Home Page';

  // Dynamic properties triggers rebuild if changed.
  int get counter => get('counter', 0);
  set counter(int value) => set('counter', value);

  // Dynamic properties can be made using complex sources, such as streams.
  int get autoCounter => getFromStream('autoCounter',
      () => Stream.periodic(const Duration(seconds: 1), (i) => i), 0);

  List<HomeItemViewModel> get items => getLazy(
      'items',
      () => [
            HomeItemViewModel('1'),
            HomeItemViewModel('2'),
            HomeItemViewModel('3'),
          ]);

  Future<int> get someData => getLazy('someData', _loadSomeData);
  set someData(Future<int> value) => set('someData', value);

  Future<int> _loadSomeData() async {
    await Future.delayed(const Duration(seconds: 2));
    return 42;
  }

  void reloadSomeData() {
    someData = _loadSomeData();
  }
}

UI Framework

This applications uses Flutter as the UI framework.

Design System

This application uses resources from Material Design. The application's theme data is defined in the global_theme_data file in the styles folder. Any other files related to the application's design system should be added to this folder.

Localization

This application uses flutter_localization to deal with the localization of strings into multiple languages.

See Localization.md for more details.