Flutter is a fast growing, cross-platform application framework. It is popular for mobile development and is gaining traction for other platforms such as web, desktop and embedded. In this blog we discuss how Flutter is currently used to develop software for the automotive industry and its future.

Flutter-for-Automotive

What is Flutter?

Flutter is an open-source mobile application development framework created by Google. It allows developers to build cross-platform applications for Android, iOS, desktop, and the web using a single codebase.

Flutter uses the open-source programming language Dart, which was also developed by Google. Dart is a modern language that is optimized for building UIs. The Dart language is compiled into machine code, which ensures its fast performance.

The Flutter engine does not rely on platform-specific rendering tools, instead it uses the open-source graphic libraries like Skia, to render the UI. This provides users with consistent visuals no matter what platform they use. The custom graphics engine gives fast, uniform, and customizable rendering.

In addition to better performance and platform abstraction, Flutter is very developer friendly. For example, Flutter supports hot reload, which allows the developers to see code changes without restarting the app and without losing the application state. When hot reload is triggered after a code change, the relevant libraries are recompiled and reloaded into a running Dart VM which in turn triggers hot re-layout without re-execution. This helps developers to quickly build and fix UIs. Flutter also comes with various tools to help inspect widgets and solve issues with UI layouts. Some of the popular IDEs such as Visual Studio Code, Intelli J (Android Studio) have excellent integration with Flutter.

Flutter Architecture

Flutter comes with a clean layered architecture that allows developers to create custom embedders that can power Flutter apps on new hardware and operating systems. Since Dart is portable, Flutter can use the same rendering stack no matter which embedder is used, thus maximizing code reuse.

The main Flutter layers are shown below.

Flutter_layers-scaled

The embedder layer coordinates and integrates with the underlying operating system services such as accessibility, rendering surfaces, and input.

The embedder is written in a platform-specific language, such as Java and C++ for Android, Objective-C/Objective-C++ for iOS and macOS, and C++ for Windows and Linux.

Furthermore, the Flutter code can be embedded into an existing application as a module or as the complete application’s content using the embedder.

The engine layer is written in C/C++, and it takes care of the input, output, network requests, and handles the difficult translation of rendering whenever a frame needs to be painted. Flutter uses Skia as its rendering engine.

The framework layer is the main interface that most developers use to interact with Flutter. The Flutter framework provides a rich set of widgets and helper components written in Dart that allow creation of modern and fast applications.

The applications themselves are written in Dart and are independent and portable to any supported operating system. If there is a need to expose platform specific functionality to the Dart code, this is done through the Flutter’s platform channels infrastructure. The app developer can write native components and have them communicate with the Dart code.

Flutter for Automotive

Due to Flutter’s ability to create visually appealing UI, cross platform support and ease of use, it is no wonder that it has found its way into automotive software development.

Flutter has been used for companion mobile applications and in-vehicle infotainment systems.

Flutter for Companion Apps

Most car manufacturers offer their own companion mobile applications to their end-users. The apps provide multiple car related functions, ranging from simple features such as access to user’s manual, maintenance reminders, scheduling service to more complex and advanced features such as remote door lock/unlock, engine start, etc.

The traditional approach is the native development for iOS and Android, where the companies need to hire two teams to develop the two versions of the same application one for each mobile platform. In addition, they still need to develop a mobile friendly website. This “traditional” method of developing apps is expensive due to the duplicated effort needed for each platform.

Due to time and cost constraints, some companies have adopted the approach of simply showing the mobile version of their websites in a native application. These are often simple apps that contain a Web View that loads the manufacturer’s website. Although this approach certainly is efficient and cost effective as it requires minimal development for iOS and Android platforms, the user experience, however, is not ideal. The UI could be sluggish, and it might not work well in offline mode.

That is where Flutter really shines. It is a single codebase solution that is easy to use, platform agnostic and offers close to native performance and the ability to save significant development effort.

Of course, this is not specific to the automotive industry. Any company that needs to develop a mobile application is thinking of how to reduce the development and maintenance cost while preserving the user experience. That’s why there are multiple companies that have adopted Flutter for their mobile needs.

In recent years, car manufacturers like BMW chose to develop their companion mobile apps using Flutter. Since 2020 they have switched their My BMW App development to Flutter. The app provides both a direct interface between the driver and their vehicle, and a communication channel with BMW dealers and the BMW brand.

Furthermore, BMW have developed a platform that allows for automated builds of every single brand, market and OS, automated test, and deployment to mobile world and backends. This means that each day several builds are triggered and with every app build 96 variants are automatically built, tested, and deployed. This is another testament to the fact that Flutter is customizable and platform agnostic.

Flutter for Embedded

The initial push for Flutter was for mobile development. For the past few years Google and the other contributors to the Flutter open-source project advanced the support of Flutter to several other platforms as well.

Within the Automotive realm, Flutter is interesting and emerging as a strong contender for an application framework for the in-vehicle infotainment (IVI) system. The traditional approach is to use frameworks like Electron, Qt, GTK, WebKit/Chromium with WebView, etc. However, there might be high licensing cost associated with those frameworks, or some are not as easy to learn and use, or others might require unreasonably high CPU and RAM that causes the UI to look sluggish.

Flutter on the other hand allows to build intuitive and responsive user interface, it is easy to develop, has low CPU and RAM requirements, and is BSD licensed.

Flutter opens the application development capabilities to a wider range of developers. Most embedded frameworks are written in C++, which is difficult to master and could lead to security bugs. On the other hand, Dart language, that is used in Flutter, is a modern language that is easy to learn. In addition, Dart also has several memory management and safety features built into it along with a powerful testing framework. The built-in memory management and safety features make Dart a very stable and reliable language for application development. For example, one feature of Dart used in Flutter is “null safety”. This feature reduces the time developers spend on code maintenance and gives them more time to focus on building their applications and ensures less application errors.

Flutter applications are larger than platform specific applications. This is because they are self-contained and have all the necessary cross-platform components included in the application package. However, mobile and embedded devices nowadays have ample storage space which substantially mitigates this concern. The benefits of Flutter far outweigh such limitations.

Integrating Flutter into new Embedded/Operating Systems

To integrate Flutter core layers to a new hardware or operating system, one must prepare a Flutter embedder for the target operating systems. There are many open-source embedders available for the various embedded platforms. As Flutter is open source, creating a custom embedder is straight forward. Developers can start from an existing embedder and adapt it for their target platform.

One such embedder for embedded Linux is provided by Sony. It is open-source under the BSD-3 license and Sony are using it for some of their devices.

Automotive Companies using Flutter for their IVI

Toyota have announced that they are using Flutter for their in-vehicle infotainment (IVI) systems. They are using Flutter’s Embedder API to develop their Linux-powered infotainment systems. Toyota have open sourced their embedded Flutter runtime targeting Linux with Wayland.

The Automotive Grade Linux (AGL) consortium has also adopted Flutter as one of their supported application frameworks. Toyota and other consortium members contributed to the Flutter adoption.

Conclusion

Flutter is now one of the most popular cross platform frameworks for mobile applications. It offers ease of development, beautiful UI, and fast performance.

In the automotive realm, JS/HTML running on an embedded WebView was popular for cross-platform development in the recent past. It has since lost some of its appeal due to poorer user experience. JS/HTML requires higher CPU and memory resources and suffers from maintenance and performance issues.

Flutter is emerging as a strong contender in the Automotive space. With Toyota and others leading the way we expect that Flutter will become a leading framework to develop high-performance, interactive automotive apps. It will likely replace the HTML/WebView approach as it requires fewer computing resources and offers better user experience. Flutter could also potentially replace C++ frameworks such as Qt with its more favorable licensing model, the ease of development and the availability of developers.

Interested to Learn More?

Contact Abalta at info@abaltatech.com. Our professional services team can help you transition to your mobile app to Flutter or help you move to Flutter embedded.