Embracing Cross-Platform Development: My Transition from Native Android Development to Flutter

Nils Vinmann
Snapp X
Published in
7 min readMay 23, 2023

A New Job and Interest in Cross-Platform Development

After honing my skills as a native Android developer, I found myself at a career crossroads. An exciting job opportunity came my way, requiring expertise in cross-platform development using Flutter. Intrigued by the potential of cross-platform development, I decided to embrace this new challenge.

Little did I know that this transition would not only open up new possibilities but also change my perception of mobile app development. In this article, I’ll share my three-year journey as a native Android developer and delve into the aspects of Flutter that excited me the most.

Familiarity with Jetpack Compose: Smooth Transition to Flutter

One factor that eased my switch to Flutter was my previous experience with Jetpack Compose, a modern toolkit for building native Android UI. Jetpack Compose shares similarities with Flutter, making the transition smoother.

The concepts of composing UI using widgets and the reactive programming model were already familiar to me, making it easier to grasp the core concepts of Flutter. Jetpack Compose served as an excellent foundation that helped me adapt quickly to the Flutter ecosystem.

Everything is a Widget: Simplicity and Collaboration in Flutter Development

I’ve come to truly appreciate the concept of “everything is a widget” in Flutter development. It brings such simplicity and fosters collaboration among us developers working on projects. With this widget-centric architecture, building the user interface becomes so much more unified and consistent.

The beauty of it lies in the ease of reusing and composing widgets. We can take existing widgets and combine them in various ways to create new ones. It promotes modular and maintainable code, which is a lifesaver when it comes to managing large projects. We can work on different UI components independently, thanks to the clear boundaries set by the widget-based approach. This means we can make progress in parallel and be more efficient as a team.

What’s even better is the ability to create and share custom widgets. This enhances code reusability and makes our lives so much easier.

Instead of starting from scratch every time, we can build upon existing widgets and make adjustments as needed. This not only saves time but also ensures a consistent user experience throughout the app.

And let’s not forget about Flutter’s widget tree structure. It’s like a visual roadmap of our UI hierarchy. It provides clarity and helps us navigate through the codebase effortlessly. Being able to see the flow of data and UI components in the widget tree makes debugging much easier.

Lifecycle Management in Android vs. Flutter: My Experience

As I transitioned from native Android development to Flutter, one key difference I noticed was in lifecycle management. In Android, I relied on lifecycle callbacks like onCreate() and onResume() to manage the state and behavior of my applications. However, in Flutter, the approach was different. Flutter takes a reactive approach to lifecycle management using widgets and their associated state objects. Instead of relying on explicit callbacks, Flutter’s UI framework automatically rebuilds widgets when the underlying data changes. This simplified my development process, as I could focus on building UI components and defining their reactions to state changes.

On the other hand, Android’s lifecycle management provided me with fine-grained control over activities and fragments through lifecycle callbacks. I could handle initialization, UI updates, and clean-up tasks using methods like onCreate() and onDestroy().

However, managing configuration changes, such as device rotation, could be complex and require additional handling.

Missing Some Features: Dart vs. Kotlin

As an experienced Kotlin developer, I must admit that there were certain aspects I missed when transitioning to Dart, the programming language used in Flutter. Notably, Dart lacked data classes, which are widely used in Kotlin for creating simple and immutable data structures.

However, Dart provides alternative ways to achieve similar functionality, such as using libraries like ‘freezed’ or creating custom classes with equatable overrides. Although it required a slight adjustment in my coding style, it wasn’t a significant hurdle, and I found the Dart language to be expressive and powerful in its own right. (There are different opinions on semicolons…. ;))

The Joy of Cross-Platform Development

The most rewarding aspect of transitioning to Flutter was the capability to develop cross-platform applications. With Flutter’s single codebase approach, I was able to target both Android and iOS platforms simultaneously, even without prior knowledge of iOS development. This breakthrough allowed me to release an iOS app without the need to maintain separate codebases, ultimately reducing development time and effort. With Flutter, you can also develop for Web and Embedded, but I will focus on Mobile for now, as it’s the area I’m currently working on at Snapp X.

Hot Restart/Reload: A Developer’s Dream

One of the significant advantages of Flutter, which I thoroughly enjoyed, is the hot restart and hot reload functionality. In native Android development, every change made to the code requires a full rebuild and relaunch of the application, which can be time-consuming. (I am aware of Jetpack Compose Live Edit feature, but it cannot be compared to Flutter’s hot reload yet.)

However, in Flutter, thanks to its just-in-time (JIT) compilation, hot restart and hot reload allow for near-instantaneous updates to the app while retaining the current state. This feature greatly enhances the development process, enabling rapid iterations, quick bug fixes, and faster experimentation.

It’s All About the Community: A Valuable Resource

Since transitioning to Flutter, I have been amazed by the vibrant and engaged community surrounding this framework. Developers from all over the world come together to share their experiences, offer support, and collaborate on various projects.

Being a part of this community has provided me with a wealth of resources, including meetups, online forums, discussion groups, and social media communities solely dedicated to Flutter. Whenever I encounter challenges or need guidance, I can rely on the knowledge and expertise of fellow Flutter developers. The active community has not only accelerated my learning but has also inspired me to contribute and share my insights. It’s an incredible feeling to be part of a community that is constantly evolving and pushing the boundaries of what Flutter can achieve.

Conclusion

Transitioning from native Android development to Flutter has been an exciting and rewarding journey for me. My familiarity with Jetpack Compose eased the transition process, and although I missed certain features from Kotlin, the benefits of cross-platform development, Flutter’s extensive widget library, and the hot restart/reload functionality made it an overall positive experience.

Embracing Flutter has expanded my horizons as a developer, empowering me to build high-quality applications efficiently for both Android and iOS platforms. As the demand for multi-platform applications continues to rise, Flutter’s ability to create visually appealing and performant user interfaces across different devices and platforms is a valuable skill to possess.

While there may be a learning curve when transitioning from Kotlin to Dart, the expressive nature of Dart and its comprehensive set of features make it a powerful language for building Flutter applications. Dart’s strong type system, asynchronous programming model, and extensive libraries contribute to the development of reliable and performant applications.

Additionally, the Flutter ecosystem offers a wealth of resources, including extensive documentation, tutorials, and a supportive community. Whether you’re a seasoned Android developer or new to mobile app development, you’ll find ample support and guidance as you start your Flutter journey. The community-driven nature of Flutter encourages collaboration and knowledge sharing, allowing developers to learn from one another and stay updated with the latest trends and best practices.

If you’re considering entering the field of cross-platform development and feel enthusiastic about the opportunities it presents, I highly suggest delving into Flutter and embarking on a thrilling new phase in mobile app development.

While experimenting with Flutter, I really started to fall in love with this powerful framework. Nevertheless, it’s crucial to stay up-to-date with the latest tech trends and advancements. While I’m loving what Flutter has to offer right now, I’ll keep an eye on what’s happening in the Android world, too. Who knows… maybe something new and exciting will come along that I simply can’t resist!

Special thanks to Nergis for her assistance in creating visuals and providing support. 🙌🏼

--

--

Nils Vinmann
Snapp X
Editor for

Passionate Mobile Developer (Android and Flutter)