Branch/Android merge with Branch/Flutter
By: Ricardo Ogliari
Tags: Development, Android, Flutter, Mobile

Ricardo da Silva Ogliari

December 26, 2020

Advising: I´m learning English, then, sorry by some mistakes in text.

Advising 2: This text was a challenge of my friend Morvana Bonin.

The Developer Conference Porto Alegre 2020

This content is the same that I presented in a important conference in Brazil: The Developer Conference. This event was online by reasons pandemic. Thanks for coordinators in my track: Ramon Lummertz, Larissa Yasin and Carlos Henrique Carmo.

Who I Am?

My name is Ricardo da SIlva Ogliari. I am TechLead in Gok One Step Ahead. I am teacher in IMED with classes in graduation in subjects about IoT, Flutter and Digital Systems. And, finally, I am teacher in MBA FIAP, in subjects about Flutter, Mobile and Mobile Engineering. I´m organizer in GDG Passo Fundo. And, I love mobile, native Android and Flutter.

Introduction

This lecture was imagined in a world where Flutter is the main platform to mobile application. I´m not said that Flutter is the better or biggest platform, it´s a little supposition. But, just imagine:

If flutter to wins the race to leadership in mobile market?

If Flutter become the pattern in mobile market?

And I, a native android developer, what I will do?

Will I have life in this apocalyptic world?

The answer

The answer is YES. There are a lot of concepts in native Android develop that we can reuse in flutter development. And I will show to you some of them:

Activity: in Android native world, when you want to create a screen, you will create a class child of Activity. See the image in below. The Flutter module live in a classe child of FlutterActivity.

In the same image pay attention in structure of folders. It´s the same organization of the a native project. This knowledge it´s very important in various moments.

Material Design: an usual design in native Android is the Material Desing. And ,in Flutter world our have one similar Widget, called Scaffold. Please, visit this site: https://api.flutter.dev/flutter/material/Scaffold-class.html. You will note some similarly properties in this Widget, i.e FloatingActionButton, AppBar, Body, Drawer, ActionButton.

Build.gradle: the build.gradle file requires a lot of work in native android development. When the developer input new configuration or new dependencies sometimes it´s necessary some interventions. The flutter acts a layer above the native, then, the same work in gradle it´s necessary in some moments.

Multidex: for example about gradle: when do you use firebase libraries, it´s usually necessary add multiDexEnable in build.gradle. In the case of Flutter, too.

Deployment: other point with high similarity with native android is the deployment. Steps like keystore generation, digital signature, reference the keystore from the app and configuration of signing in gradle are a lot similar between native and Flutter. Look this -> https://flutter.dev/docs/deployment/android. In Flutter we build an APK or an App Bundle too.

Platform channel: Flutter contains the platform channel concept. It´s enable our dart code to exchange data with native code. Then, in the side native, it´s necessary have knowledge with Java or Kotlin code. To know the lifecycle of Android application and lifecycle Activity it´s welcome too. For example, see the example code below. The code was write in Kotlin and run in the native side.