Breaking up with Flutter, getting along with PWA
Tags: flutter, pwa, javascript, mobile
Published: 2021-05-07 01:37:06

Yeah! I had enough of flutter. I will like to keep it short.

# 7 problems I had with Flutter:

1. **No separation of style, coding and layout**. An infinite depth widget tree for creating a simple animated button. The code looks ugly as hell, the bigger the project gets the uglier and difficult it becomes to manage.

2. **Its not cross platform in true sense**, once you dwelve into the world of plugin writings. You will often be in position wher you have to write code in swift (For IOS) and C/C++/Kotlin for android. So how can it be called cross platform, when some one else does have to write a code for both platform!

3. **App Size is too big**. You use 3 Plugins and your project become bigger than any app on the planet!

4. Unecessary **Programming Context Switching** : Front end code in Dart, Back end code in Javascript.

5. **Requires App store to publish app**: Publishing through some kind of App store! We all know their [monopoly and dictatorial regimes](https://www.bbc.com/news/technology-53777379)!

6. **The development time of any decent app will be too big!**

7. **Requires Heavy machine to do the job: One requires pretty good machine to do the job.** A Flutter full stack developer would have to open follwing big apps to work.

* IDE: Say Android studio (Very big in itself) and if you are creating a modular project, one has to open two to four instance of Android studio.
* Chrome/Firefox: You would have to google code many times, and that too many tabs!
* Emulator. Its pretty Big app in itself.
* IDE for back end code. Which again if is modular (which every big project must be), then you need to open two to three instance of such IDE.
* Docker with local instance of DB/ Micro services.

I have a 8 GB Linux machine with 16 GB swap memory and it made me cry, as apart from writing codes in DART, Javascript (for backend), DB programming , I would have to manually manage memory on my system.

So why [PWA: Progressive Web App](https://web.dev/what-are-pwas/).

> Its a new breed of websites , which user can install on IOS, Android and Desktop, just if they were some mobile apps. Yeah install, just like regular mobile apps user can install them on their mobile phone. By installing it means one can cache any big file at user machine, and it wont be fetched from server again and again! (Just as your regaulr mobile app gets installed once).

As they are plain simple websites, one can create them with just HTML, CSS, and Javascript.

There are [tons of better articles](https://www.youtube.com/results?search_query=progressive+web+app) which will give you what PWA are and their capabilities. I will like to rather focus on how PWA solve above problems.

In the rest of the article, I assume you already know what PWA are.

Solutions to above problems solved by PWA:

1. **No separation of style , coding and layout.**
I think any one who knows HTML,CSS and JS knows how it solves this problem pretty good.

2. **Not cross platform in true sense.** 
Well web works every where*. If something is web standard, its gauranteed to work on all system which adheres to it.
Yeah I will be fair here I do need to acutally write code sometimes to target specific machine, but its a one time job. I wanted to to access contacts on user machine, and PWA only offers this kind of access on newer Systems, to target old system, I wrapped my PWA in pure Android JAVA code!

3. **App Size is too big.**
A decent flutter app which uses few plugins, will end up of being pretty Big!
A same flutter app which was half completed was of 30 MB in size, and the one developed in PWA was mere 88 KB!
I started this app with Flutter ended up with 30 MB code during mid development, then I tried it on PWA! and developed whole app in JS, HTML and CSS, latter at last moment came to know I cannot read contacts on old mobile phones !
I googles some shell projects which can give me access to Contacts and expose javascript functions to my webviews. I created such shells, and such shell only were of 88 KB size. If I had to design any app in future which requires contacts, I can reuse this shells.

4. **Programming Context Switching.**
Front in dart and back end in javascript.
My story on this goes like this. I had been a JAVA developer for almost a decade , and then I switched to javascript as I hated Context switching and simplicity of Javascript and NPM at that time.
Now when I swicthed to flutter I am again to the same problem I solved many years back: Context switching!
Well now on PWA all I have to code is in javascript every where. I have chosen my database too which uses Javascript for most of its functioning (CouchDB).
All I need to focus is on one langauge and I am good to go.

5. **Requires App store to publish app**
Well PWA can be published on App store and can be hosted on your own servers too, from where user can install them fearlessly!

6. **The development time of any decent app will be too big.**
Coding in HTML/CSS/JS is way faster then coding widgets tree with the depths of hell.

7. **Requires Heavy machine to do the job**
All I need is one IDE with integerated browser. Say VSCODE to work on my back end / front end , runnig dockers and no eumlators required.