Jan 31, 2024

Flutter Beyond Mobile and Web

This article breaks down the talk by Bhasvanth Dev, Student and Co-Founder at Nyx, at the recent Flutter meetup held at GeekyAnts.
Ahona Das
Ahona DasSenior Technical Content Writer

In his talk, Bhasvanth took us on a journey deep into the world of Flutter for Wear OS, uncovering the magic of the Wearable Rotary plugin. This Kotlin-based gem, courtesy of Samsung, emerged as a game-changer by seamlessly bridging the gap between Flutter applications and the dynamic world of wearable gestures.

The Marvel of Wearable Rotary

Screenshot 2024-01-30 at 2.52.32 PM.png

At the heart of this exploration is the Wearable Rotary plugin, a technological marvel designed to facilitate communication with native code and capture wearable gestures. The plugin introduces the concept of "generic motion events," shining a spotlight on its ability to interpret motions like the rotation of the bezel. The motion data is then seamlessly integrated into Flutter applications, enhancing user interactions with every twist and turn.

A key feature of the Wearable Rotary plugin is the event channel, Flutter.variableRotaryChannel, continuously streaming data to Flutter applications through a subscription model, fostering a crucial link between the two worlds.

A Glimpse into App Development

The live coding session kicked off with the creation of a basic counter application, laying the foundation for the journey ahead. The initial steps involve tweaking the build.gradle file to accommodate the Wear OS SDK, highlighting the importance of version 223 for compatibility.

We dived into the core of the variable rotary plugin, deciphering the Kotlin code that powers its functionality. Despite encountering some challenges in locating the source code, the session emphasized the need to grasp the fundamentals of Flutter for effective plugin integration.

Making the App Come Alive

The counter app evolved, incorporating additional methods and refining the user interface. The Wearable Rotary plugin took center stage, with an emphasis on the significance of proper initialization and subscription handling.

A pivotal moment unfolded as the app was run, revealing how the rotary motion of the bezel seamlessly interacted with the counter application.

Beyond the Basics

Buoyed by the success of the counter app, Bhasvanth next created a music app. The session focuses on small screen optimization, responsiveness, and battery efficiency, culminating in the development of a music player controlled by the bezel's rotation.

Challenges and Triumphs

Bhasvanth shared the challenges faced during the journey, including debugging woes and the importance of optimization. Anecdotes, like developing a Flappy Bird app, highlighted the diverse applications possible with Wear OS development.

The Wear OS Landscape

The session concluded with a deep dive into the Wear OS development landscape, addressing factors such as ambient mode and always-on display considerations, underscoring the importance of responsiveness, small screen optimization, and battery efficiency in Wear OS app development.

The live demonstration showcased the app running on an actual Wear OS device, proving that the challenging journey culminated in success. The potential for creating innovative and practical applications for Wear OS using Flutter was vividly illustrated, leaving the audience inspired to explore these possibilities themselves. The stage is set for a new wave of creativity in Wear OS development.

Check out the full talk and demonstration here 🔽

Hire our Development experts.