A Flutter weather application that fetches weather data from the OpenWeather API using Dio.
- Search for cities to get current weather data
- Display previously searched cities
- Save and retrieve previously searched cities using SharedPreferences
- Display weather details for a specific city in the
DetailsScreen
- HomeScreen: The main screen displaying the current weather and previously searched cities.
- SearchScreen: A screen that allows the user to search for cities.
- DetailsScreen: A screen that displays detailed weather information for a selected city.
HomeScreen | SearchScreen | DetailsScreen |
---|---|---|
- CityProvider: Manages city search results and stores previously searched cities.
- WeatherProvider: Manages weather data fetching and storage.
- Flutter SDK: Install Flutter
- Dart: Install Dart
-
Clone the repository:
git clone https://github.com/yourusername/weather_app.git
-
Navigate to the project directory:
cd weather_app
-
Get the dependencies:
flutter pub get
-
Connect your device or start an emulator.
-
Run the app:
flutter run
- On the
HomeScreen
, you can view the current weather and a list of previously searched cities. - Navigate to the
SearchScreen
by tapping the search icon. - On the
SearchScreen
, enter a city name to search for weather data. - Select a city from the search results to view detailed weather information on the
DetailsScreen
.
- Dio: For making HTTP requests.
- Provider: For state management.
- SharedPreferences: For storing previously searched cities.
This project uses the OpenWeather API. You need to replace YOUR_API_KEY
in the CityService
class with your actual OpenWeather API key.
final String _apiKey = "YOUR_API_KEY";
This project is licensed under the MIT License - see the LICENSE file for details.
Make sure to replace YOUR_API_KEY
with your actual OpenWeather API key and the GitHub repository URL with the actual URL of your repository.