Why is Google Pay re-written in Flutter?

Google Pay, Google’s own payment service platform has established its place among one of the most popular payment services in the world. It has made payments easy for millions of users and businesses through a smooth and easy to interact with interface. 

The app lets users pay bills, top-up phone data plans, buy tickets, get loans etc. along with rudimentary messaging capability. It is secure to use and its user-friendly nature has got it a huge user base. It was launched in the year 2015 by Google and was initially Android pay. It has more than 10,000 employees working in developing the app and over 100,000,000 downloads on Google Play store. Due to its smooth user experience, it has gathered a huge user base. Around 150 million people are said to have actively used the app by April 2022. 

Before we get into why Google Pay switched to Flutter, let’s quickly go over Flutter and its features.

About Flutter

Flutter is an open-source framework by Google for building beautiful, natively compiled, multi-platform applications from a single codebase. Flutter is not a framework or library; it’s a complete SDK- software development kit. 

Many large businesses like Toyota, BMW, eBay, Alibaba Group, Groupon have chosen Flutter to design mobile apps capable of providing a great customer experience. 

  • Flutter helps developers create a single code for different platforms which reduces development time by around 30-50% (depending on the complexity of project) compared to native technologies. 
  • When it comes to code maintenance, maintaining two codebases is very difficult and developers have to create updates for each platform and identify bugs. Maintaining a Flutter code is easier as the lines of code is about 30% lesser and since there is a single codebase, errors are relatively easy to be identified and third-party libraries can be supported.
  • Native development is much more expensive than Flutter development. Use of Flutter can save you around 45% on development, 70% on QA taking into account the use of auto tests, and around 33% on app designs. So Flutter can save the cost from around 15-20% to 50%.  
  • Flutter uses ready made widgets which helps create a user interface acting as building blocks. Any object in Flutter is a widget, from a button to padding or a font. Widgets can be combined to create layouts, and you can choose to use widgets on any level of customization. 
  • In Flutter, there is no need for XML files. In Android development, the work is separated into layout and code. The layout should be written in XML as Views that are then referenced in the Java code. Dart takes care of that by keeping the layout and code in one place. Since everything in Flutter is a widget, the layout is also created in Dart.

What was Google Pay using initially and why did they switch to Flutter?

Google Pay was initially built using native apps – Swift for iOS and Kotlin for android. This is because native apps are considered better than hybrid frameworks in terms of performance, security, user experience, and access to hardware. Due to the resource crunch, and such a huge user base, Google decided to switch to Flutter. 

Through Flutter, the need for a highly scalable cross-platform app which can reduce time and cost can be fulfilled. Some of its advantages are

  1. Similar to native apps
  2. Takes less of code writing time
  3. Same UI across platforms
  4. Greater time-to-market speed.
  5. Easier platform specific logic implementation.

One of the reasons to select Flutter is that it gives uniform experience across different platforms. Flutter apps are written in Dart and leverage the best features of Dart to make development easier and faster while Ahead-of – time compilation offers high performance and easier deployment.

The JIT (Just-In-Time) execution engine of Flutter allows intermediate reflection of changes in code, without the need to refresh or restart the app. It also offers a stateful hot reload where changes can be reflected in the running app without loss of a state of the app. 

Google’s development teams liked using Flutter as it significantly reduces the time to create a smooth and beautiful user interface. With high-quality widgets, consistency in UI development, and hot reloading, Flutter makes happier teams and offers a smoother development experience.

Challenges

Rewriting the app in Flutter meant that there was a need for high investment, but it would help the developer team increase the speed and efficiency of their development for faster response and implementation times. Instead of having to put in double the effort in managing both iOS and Android, they chose Flutter.

  • They had to retrain their team on a new language, platform and how to approach the user interface. 
  • They had to keep track of the app’s updates during the process of rewriting the app. 
  • They would need to jump through all of the necessary security reviews and audits for a second time where the app was already launched.

Result

Despite all the struggles, the Google developer team rewrote the app in Flutter which brought many positive results. There were a lot of new features added, but still the codebase remained smaller by about 35%. The team estimated that it saved about 60-70% of the engineer’s time as Flutter is easier to manage. Google Pay was able to scale quickly and efficiently due to Flutter and spread to various parts of the world.

Other Apps built on Flutter

Google Ads

Google Ads helps users run ad campaigns while on the go. The app creators leveraged the Flutter framework to effectuate the Material Design elements within the user interface.

The app comes with tons of features such as campaign stats, realtime notifications, update bids, and budgets, keyword editing, and instant support from Google experts. It has a huge user base with more than 10 million downloads on Google Play store.

Play Store | App Store

eBay

eBay Motors released a Flutter app for iOS and Android devices in 2019. eBay Motors is a marketplace where you can find new and used automobiles, as well as components for repairing, upgrading, or maintaining your current vehicle. 

With over 5 million cars sold on the platform to date, eBay Motors is ideal for locating and purchasing specific vehicles, whether everyday commuting cars or exotic supercars.

Play Store | App Store

BMW

The Flutter framework was used to build the My BMW App, which became live in July 2020. Its use has grown to include 47 countries throughout the globe, and the app works as a universal interface to give users a smooth transition between their mobile device, automobile, and the digital world.

Play Store | App Store

Xianyu by Alibaba

One of the biggest e-commerce companies in the world, Alibaba, used Flutter to develop a visually appealing iOS and Android app experience for its Xianyu app, which has received more than 50 million downloads. 

An online marketplace for secondhand items called Xianyu (Idle Fish) is built on the Alibaba Group’s e-commerce platform. This platform offers distinctive capabilities to satisfy distinctive customer wants because the secondhand market is complex.

Play Store

Google Stadia

Stadia is Google’s gaming platform that allows you to play your favourite video games in real time. Stadia currently has over one million downloads and 130 games.

Play Store | App Store

Flutter is an efficient framework to build apps which reduces the lines of code, engineer’s effort and the cost in building the app. In Spite of having to face challenges, an app with a user base as large as Google Pay has, is proof of how beneficial Flutter is. In coming years, a lot more apps will be built in Flutter.