Skip to content

Conversation

@harrydbarnes
Copy link

Moved expensive weather data processing logic out of the build method in lib/screens/home.dart. Previously, the app was parsing DateTime strings and iterating over large lists (hourly data) on every frame/rebuild of the home screen.

Changes:

  1. Created lib/models/weather_display_data.dart to hold pre-processed view data.
  2. Implemented processWeatherData function to handle data transformation once.
  3. Updated WeatherHome to fetch and process data asynchronously, passing the ready-to-use object to the UI.

Moved expensive data processing (date parsing, loops for filtering hours, rain logic) out of the `build` method in `lib/screens/home.dart`.
Created `WeatherDisplayData` model to hold processed data.
Updated `FutureBuilder` to use pre-calculated data.

This reduces CPU usage on every rebuild of the home screen.
@PranshulGG
Copy link
Owner

@harrydbarnes Looks good, did you test the refactor on-device/emulator to make sure the UI still updates normally and nothing breaks?

@PranshulGG PranshulGG added the waiting for feedback The issue requires input or clarification from others before proceeding. label Jan 1, 2026
@harrydbarnes
Copy link
Author

harrydbarnes commented Jan 2, 2026

@harrydbarnes Looks good, did you test the refactor on-device/emulator to make sure the UI still updates normally and nothing breaks?

@PranshulGG Built out an apk now and will test. Had the below error during setup when trying to use current location. Used import backup and was fine. Do you see this error at all?

Error:
Error: Exception: WeatherService.fetchWeather failed: Exception: HTTP request failed with status: 401

@PranshulGG
Copy link
Owner

@harrydbarnes I don’t see this error, it’s probably an API issue or something similar. I’ll try to include this PR in the next release after some testing :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting for feedback The issue requires input or clarification from others before proceeding.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants