Developement Insight #1

Developement insight

Insights into my current state of developement in kinds of flutter app developement.

Foreword

Googles framework flutter offers the opportunity to compile native applications for different operating systems on a basis of the same code base. So one code for Android, iOS, Web, MacOS, Windows… while it is still possible to separate per OS and still implement platform dependent functionality. This may be necessary using hardware close components, just in case there is no liable package out there. pub.dev offers a variety of such packages and is used as standard source for it. While an apps source code is written in Dart, platform dependent functionality may be written in such an dependent programming language. The interface’s structure has a tree like structure like it has in html. One thing, which every flutter developer becomes aware of very soon:
everything is a widget

For further information see Flutter and Dart

Developement Environemnt

The developement environment VSCode holds a variety of extensions for many programming languages and systems. Also for flutter. Be it starting the app in different configurations, with an emulator, in web or as desktop application, executing necessary build tasks, managing todo, info or any further comment tags or optical emphasis and illustration of code, almost everything is accessible by hotkeys. Although most of this functionalities are only available in terms of extensions, search and installation of these extensions is very simple on the extension tab. There are many articles about different useful extensions per programming language.

Version Control

I chose GitLab for version control, which offers the ability for private projects for free. Besides common git functionality continious integration / continious delivery is of matter for me. For example it enables to start code coverage and show its result as badge in the README. You can also execute tests or any other programms and operations here, which the image has to offer.

CI/CD

As mentioned above code coverage is created with gitlab’s CI/CD. After a tasks succeeded, CodeMagic is fired. Codemagic builds an app for different operating systems and delivers them according to the configuration. (e.g. Google Playstore, iOS Appstore)
Therefor you can create different build configurations, which’s build can initiated by different events of the repo automatically.

Datamanagement

Firebase is used as easy solution for saving and managind data. It can be straightly used in dart/flutter code with the Firebase package. With it data can be modified with definable rules, do authentication, trigger notifications in app and serves as hosting platform for web versions of apps. You can even use an extension to send mails automatically. Firebase offers much more functionalities, I haven’t discovered so far.

Basic Software-Architecture

I determined an Domain-Driven-Architecture as one app’s architecture.

The basic idea was inspired by Reso Coder DDD

DDD-Architecture-Proposal

Domain-Driven-Design

In this proposal there are 4 different layers with smooth transitions:

  • Presentation
  • Application
  • Domain
  • Infrastructure

The domain layer having no dependencies from any other layer is the most important rule to consider. This layer is in charge of entities, which are used in it’s domain, of value objects, which holds validatable values and are used in entities traditionally, of declaration of functionalities to be implemented and of defined failures, which can occur during communication with the infastructure layer. The infrastructure layer provides communication with systems, which’s functionalities are declared in the domain layer. Thereby it can communicate with both local and external systems and can be replaced modularly. Depending on communicaiton direction entities are converted to data transfer objects or the other way around. Occuring exceptions are converted to failures defined in domain layer to handle them later in upper layers like the application layer. Following the figure, BLoC is used as state management solution. Despite that in my projects I use Riverpod. It manages states, which show up on the interface. In the figure the application layer handles use cases. In implementation the layer orchestrates data between upper and lower layers. In contrary to the figure states and events are managed here. Widgets, which are shown on the interface, only lay in the presentation layer. The smooth transition between application and presentation layer delivers data over states and events from the infrastructure layer contractually secured by the domain layer from user to infrastructure systems and the other way around.

Examples

https://gitlab.com/goevexx/flutter-js-card-trick (contains antipatterns potentially)

Look to the future …

In the near future I look out for applications for apps, which can base on this composition to refine and improve it. Furthermore I hold out the prospect to free me from firebase by implementing a serverside linking and management of data in golang.

comments powered by Disqus