This Flutter app project provides real-time weather information for your current location. It utilizes the Weather package and OpenWeatherMap API for fetching weather data and the Geolocator package for retrieving your location. Additionally, it employs the Flutter Bloc pattern for state management.
- Real-time weather updates based on your current location
- Displays current weather conditions including temperature, humidity, wind speed, etc.
- Utilizes the Weather package and OpenWeatherMap API for accurate weather data
- Uses Geolocator package to fetch user location
- Implements Flutter Bloc for efficient state management
- Clone this repository to your local machine:
git clone https://github.com/your_username/your_repository.git
- Navigate into the project directory:
cd your_repository
- Install dependencies using Flutter's package manager:
flutter pub get
-
Create an account on OpenWeatherMap and obtain an API key.
-
Add your OpenWeatherMap API key to the project:
- Navigate to
lib/services/weather_api.dart
. - Replace
'YOUR_API_KEY'
with your actual API key obtained from OpenWeatherMap.
- Run the app on a connected device or emulator:
flutter run
- Upon launching the app, it will request permission to access your device's location. Grant permission to allow the app to fetch accurate weather data.
- The app will automatically fetch weather data for your current location and display it on the home screen.
- You can also manually refresh the weather data by pulling down on the screen to trigger a refresh.
This project relies on the following dependencies:
- Weather package: A Flutter package for fetching weather data from various sources.
- OpenWeatherMap API: A service providing weather data from around the world.
- Geolocator package: A Flutter package for retrieving device's location.
- Flutter Bloc: A predictable state management library that helps implement the BLoC (Business Logic Component) design pattern.
- Flutter Dotenv: A Flutter plugin for handling .env files.