State Flows
An Android Application written purely in Kotlin exploring various usages of Flows and Coroutines in a Real World App.
Medium Articles
Follow me on Medium for latest articles.
Medium Article | Github Branch |
---|---|
Form Validation using Mutable State Flows | pending |
Smart Listener for Shooting requests | pending |
Cases
Form Validation The Screen contains three input fields, the **Submit** button is only enabled once all the 3 fields are properly filled.
- First Name must contain only alphabets.
- Password must be atleast 8 characters long.
- User Id must contain an underscore( _ )
Once all these fields are properly filled only then the Submit button is enabled. The Submit button disables again if any of the fields are edited and the conditions are not met.
Smart Listener for Shooting requests
For this we use an example of a search query. You don't want to shoot a request whenever the text is edited but wait untill a couple of seconds before shooting a netwiork request.
This way you reduce the number of requests and only return result for the latest text query. For Eg: User may type "Co"..."Coff"..."Coffee". You'd only want to shoot a request when the user has typed the whole word instead of sending a request for every input.
Tech Stack
Roadmap (Features to be added )
- Exponential Backoff for Network Requests
Find this repository useful? ❤️
Support it by starring this repository. ⭐
And follow me on Medium and Github
Issues and Contribution
Find any other use case scenario for Flows? Hit a PR!
Project Maintainers
This project is founded and actively maintained by Shivam Dhuria.
Credits
Got the idea from Kaushik Gopal
Libraries
- Retrofit2 & OkHttp3 - construct the REST APIs and paging network data.
- Gson - Gson is a Java library that can be used to convert Java Objects into their JSON representation.
- Room - For storing Database.