This week I learned BLoC Architecture in Flutter, I understood it quickly from YouTube videos. I started implementing it in App.
I will try to explain first what BLOC components should do as short as possible (and as trivial as possible).
UI screen - obviously shows data to the user
BLOC (or the ViewModel) - decides HOW to display data to the user, do we make the text bold, do we show the error, do we go to next screen.
Repo - decides WHAT data to display to the user (do we show the content from db, do we fetch it from API)
I have created BLoC for home screen & location services, I have done the following tasks in Home screen
Fetched & Displayed User Location using Geolocator Package App will ask for location permission & will access location of user, I have used two packages
location - For asking GPS Permission
GeoLocator - For Getting coordinates of user location
Fetched Nearby Hospitals using Overpass API
Used Overpass API for Getting Nearby Hospitals, I have to pass Location Coordinates & radius to get hospitals around my Location
Then I Parsed JSoN data recieved to list of objects
Fetching Image of each hospital from Google
- For fetching images, I have Used FutureBuilder Widget in flutter which executes a function which searches on Google by Hospital name & fetches the HTML Response, Then I get the link of first image & pass it to another widget Cached Netwrok Image which loads the image.
Using Shimmer Loading Effect to load list
- I have use flutter shimmer package for doing this, I have created a ListTile for this, While the data is Loading I display this.
Completed Main functionality of SQL Database class
- Implemented Basic Insertion in SQL Database using Flutter sqflite package, Some Other function are remaining which I will complete in upcoming weeks
Scraped CDM of Indiana State
- I have Used Data Provided by Indiana State, It contains discharge data of Hospitals of 2018, I have scraped data using scrapy, processed data to proper column names using python.
I have used shared pref to store some data, I will replace it with Hive
I will use sqflite to store CDM
Working on Main Feature of this App [ Compare Prices Screen]
Scraping CDM of New York State