Snow is a Flutter mobile application built to help users find upcoming programming contests from 10+ major platforms and set reminders for them. I built this application from scratch by myself and used a freely available open-source API as my data source. This project required a lot of heavy lifting in state management and debugging issues with local push notifications as well as storing custom data types in local storage.
Frameworks and Libraries Used
- Flutter
- Bloc state management
Background
Snow started out as a Discord bot that me and a friend made during online university in 2020, which supported only two platforms: CodeChef and Codeforces. We had just started out dabbling in competitive programming and wanted a convenient way to find a contest to participate it. Later I started working on a mobile app for the same (my friend no longer wanted to work on this). This came into being as a mobile app called Snow Classic.
Problems
The classic app had a hardcoded light theme and push notifications did not work on my OnePlus but worked flawlessly on a friend's Samsung. It had state management that did not scale. These issues taught me the importance of writing clean and maintainable code the hard way.
Equipped with knowledge and experience from Snow Classic, I began a rewrite of the app and this is how the current app "Snow" was born. While working on Snow I spent a good amount of time cleaning up and refactoring the code that I wrote and made sure everything was easily modifiable later on. I have been a stickler for writing clean code ever since.
For example, initially I had my API calls in the same file as my state-management code which grew to an unmaintainable 500+ lines of code. Later, I learned about the concept of Dependency Injection and moved out my API calls to a separate package which I made my app depend on.
Also, I redid the design when rewriting.
Spotlight
Figuring out push notifications for reminders was tricky. They were being delayed from the scheduled time on my device, but were being delivered on time on emulators and a friend's device. I did a deep-dive in how Android handles and schedules notifications, and found out that if the battery saver settings were enabled on a device then notifications could be delayed. So I added an option in the app settings to exempt the app from the battery saver settings.
I also realised manually (de)serialising objects to/from JSON was a surprisingly tedious, and hence a potentially bug introducing task. While researching better ways to do this, I stumbled upon code generation solutions for this problem. I ended up using a library to automatically generate serialisation and deserialisation code for my model classes.
Current Status
I was pleasantly surprised to find out Snow has amassed over 130 downloads on GitHub. It is being used by four of my friends, and has begun to occasionally attract pull requests and issues from the open source community and users of the app.
Learnings
I could spend all day describing things I learned while working on this project but some of the most significant were my improved understanding of the Flutter SDK, State Management, Git Workflow, API integration, and Widget lifecycles. This project also helped me transition from relying on tutorial videos and blogposts to reading official documentation as my primary source of learning a new library or technology.