Skip to content
This repository has been archived by the owner on Oct 22, 2021. It is now read-only.

Architecture

Marcel Garus edited this page May 14, 2019 · 14 revisions

The app is covered into modules, each of which has its own folder.

Currently, there's only the news module, but there are about to come many more. Probably.

Every module has a similar structure:

  • The model.dart file contains all the classes that make up the relevant data structures for that model.
  • The bloc.dart file contains the BLoC, a class that handles the business logic of the module. It provides convenient methods to the UI and uses Futures or Streams for returning data where it's appropriate.
  • The widget folder contains all the widgets that are used to make up stuff from that module from a small helper widget up to the needed screens.
  • The <module name>.dart file offers only the most important things of this module to be used by other parts of the app.

Example

Let's take the news module as an example.

  • The model.dart contains the Article class.
  • The bloc.dart contains the logic for fetching articles from the server and storing them. It provides two methods to the UI: Future<Article> getArticleByIndex(int index) and void refresh().
  • The widget folder contains loads of widgets - if you have any questions about how to structure them, I encourage you to have a look at how they work.
  • The news.dart file publishes the NewsScreen widget to the rest of the app, as this is the only entry point to this module.
Clone this wiki locally