Our Showcase App — DrutaFit
DrutaFit is our first mobile application written using DrutaVahan toolkit. Its a simple mobile application to track your walking activity and targeted at people with desk jobs. Today, seating for long hours is as dangerous as smoking. Walking is recommended way to increase activeness if you can not dedicatedly spend time for workout out of your busy schedule. This mobile app will help you keep informed about your activeness.
DrutaFit as a case for cross-platform rapid app development
At Druta.io, I always think how to reduce time to create mobile applications without compromising on any of the delivery quality and user experience. Bigger obstacle in writing multi-platform mobile application is mobile application development is anti-cross platform by design.
What is cross platform?
I consider any code you write be it application logic, user interface, backend interaction as a candidate. Of course, each platform and different OS versions within each platform will require special handling but large portions of your code should be runnable on all target platforms. Take an example of Linux kernel. Its written in C but its probably the most “cross-platform” computer software ever written. Today, Mobile application development is anti-cross-platform by design. Android and iOS hardly share anything among them out of the box and efforts like Xamarin and React Native, Hybrid Html5 (PhoneGap, Ionic) try desperately to be cross-platform development platform but fail short. Hence I chose Flutter as Druta.io main development platform for DrutaFit and it turned out very right choice. Total Lines of Code is 5K and out of which 80% ~ 4K (user interface, business logic of coin calculation, backend interaction) is cross-platform. Remaining 1K is Java code which is native module needed for reading fitness data from Play services and is android only.
Why Flutter?
I chose Flutter because it exactly meets Druta.io’s motto of fast development without any compromise on performance and development.
It provides
Fast Development — Hot Reload in milliseconds to paint your app to life. Use a rich set of fully-customizable widgets to build native interfaces in minutes.
Expressive and Flexible UI — Quickly ship features with a focus on native end-user experiences. Layered architecture allows full customization, which results in incredibly fast rendering and expressive and flexible designs.
Native Performance — Flutter’s widgets incorporate all critical platform differences such as scrolling, navigation, icons and fonts to provide full native performance on both iOS and Android.
In my previous experience with other frameworks, all buzzwords mentioned above turned out to be below par experience. Other frameworks use existing tools and adapt it for mobile development which results in multiple layers which leak performance, UI responsiveness, battery life etc. What differentiates Flutter is its complete rewrite of every layer of development stack — right from language runtime to UI render layer and rightly so as its supposed to be official app development platform for google’s Hybrid child OS out of Android and ChromOS parents — Fuchia.
Flutter takes application development to the realms of web development and beyond with its stateful hot reload and different compiler for debug and release (Ahead of Time, Native ARM6 Binary) builds. Another thing which Flutter got it right when compared to web-development, is that Flutter allows creating widgets that listen to each other in a simple and intuitive way. It is a result of effective use of the composition. Dividing widgets into ones that look, ones that position their children on the screen, and ones which control behavior creates limitless possibilities for the designer and developer.
In Flutter, everything is Widget and Widgets have Reactiveness in their DNA. Beyond user interface, flutter makes access to native elements like camera, Bluetooth intuitive using Platform channels. Flutter offers plugins for most of the common native requirements. On May 7 2018 Flutter went to Beta 3 and announced as production ready.
Dart Programming language is mostly Java with little syntax quirks and does not come in your way and is the most used programming language in Google.
Today, Flutter is very mature, complete framework to start fresh app or migrate part of your application.
Back to DrutaFit

DrutaFit reads your walking data from Android Play services (specifically pedometer sensor) and analyzes it for three key attributes — Consistency, Intensity and Quantity. As its showcase for Flutter’s development experience, I tried mimicking Google Fit’s user interface and it did not take much effort.

Based on three key attributes user are granted coins of three type — Gold for intensity, Silver for consistency and good habits and Bronze for number of steps he walked. In above screen-shot, Wed-Thu-Friday, 3 day long streak of minimum 7200 steps gets the user “devc” silver points.

Leaderboard gives you an idea of where are you.. Most often, when you start taking walking seriously, will never catch a guy who already is very much ahead of you, hence DrutaFit also maintains Weekly view of activity. Weekly view helps to maintain shorter (which are more practical and achievable) streaks and offers you fresh “Game” each Monday which you have same chance at winning like everybody else.
Design
Flutter Out of the Box is reactive framework but does not enforce or suggest an architectural style for your application. Any large practical application your are required to maintain global state and Redux architecture is proven design pattern.

DrutaFit employs redux store using flutter redux plugin. UI code is implemented using Widgets and connected to redux store using container which has redux StoreConnector widget at its root and knows how to get hold of store from any of the parent widgets. If you use out of the box StatefulWidget, UI, State, action and callbacks all live in single class. But using redux plugin clear separation of concerns between UI, State and actions was achieved.
DrutaFit implements native module for reading fitness activity data using Platform channels. Platform channel is also used to create unique device identifier (used as key for storing derived data in cloud) from variety of phone attributes. Flutter integration with native elements is very neat and designed for minimum lines of code.
DrutaFit draw charts using flutter chart plugin, charts apart from standard functionality also offer interactivity. I suspect, this chart plugin has origins in google’s own chart webapi as Dart is used in Google for lot of web projects.
So, in 4000 lines of code, I managed to write an application which reads fitness data from native land, analyzes the fitness data, draws beautiful interactive UI, syncs data to cloud (using DrutaVahan’s client toolkit. DrutaVahan in Sanskrit means fast vehicle. We will discuss in next section), sends local notification. Storing data locally for off-line access is not implemented yet but I expect it to be less effort as there is sqlite plugin available which works cross-platform.
Backend Integration
DrutaFit uses DrutaVahan’s client side toolkit for interacting with Backend. In DrutaVahan, backend is set of services deployed on Cloud platform which in this case is AWS. DrutaFit uses Vahan’s Document Storage service deployed on AWS.
Schema
Each day of physical activity is stored in side DynamoDB using a Coin entity. Coin entities are also aggregated hence have three types — Daily, Weekly and all-time. User’s deviceId and timestamp forms hash and range key respectively and to enable leaderboard query, global index is created on type and timestamp. I specify this information (entity, schema and other resources) using DrutaVahan’s configuration and rest of the tasks — table creation, index creation, dynamo db service all are taken care by DrutaVahan. DrutaVahan also offers client in Dart which I imported in Flutter. Client offers all capabilities of DynamoDB. Thus coin sync is achieved using 3 Backend API calls
- updating user’s daily and weekly coins,
- aggregating user’s total coins
- calculating weekly and leaderboard
Entire Backend integration code for is just 300 lines of code. Thanks to DrutaVahan.
Future enhancements planned for DrutaFit
Main objective of the showcase — Flutter evaluation is successful and it fits perfectly into Druta.io core principles. DrutaVahan has simplified backend integration.
To take this further, I am planning to add new feature into DrutaFit to experiment further areas of mobile app development with Flutter.
History View for Steps and Coins
Currently, there is no way to see history of steps and coins. So new history screen will be added. But before that local history has to be saved for off-line access. Sync repository needs to populate local sqlite database with user’s data. This can further open-up another enhancements — additional analysis of user’s fitness activity and smart local notifications.
Groups
There is no grouping of users. Each user is only identified by avatarName he chooses to identify himself. It will be nice addition to allow groups so that users can form a group among themselves and compete and interact with each other. I am planning to add separate web-app as well to manage the Groups — Admin, Send invite etc.
Conclusion
Writing DrutaFit application and integrating it with DrutaVahan backed backend has been very pleasant experience. In DrutaFit, I have perfect showcase for Druta.io which promises — Beautiful and cross platform applications with cloud hosted Backends using latest tech stack in record time.

