This repository has been archived by the owner on Oct 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
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 usesFuture
s orStream
s 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.
Let's take the news
module as an example.
- The
model.dart
contains theArticle
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)
andvoid 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 theNewsScreen
widget to the rest of the app, as this is the only entry point to this module.
Need help? Feel free to contact Jonas Wanke, a former member of the Flutter team at the HPI Schul-Cloud :)