-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest_api_key.dart
More file actions
26 lines (23 loc) · 803 Bytes
/
test_api_key.dart
File metadata and controls
26 lines (23 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Test file to verify API key setup
// Run this to check if your API key is working
import 'package:flutter/material.dart';
import 'lib/services/weather_service.dart';
void main() async {
// Test if API key is set
if (WeatherService.isApiKeySet()) {
print('✅ API key is configured');
try {
// Test API call
final weather = await WeatherService().getCurrentWeather('Delhi,IN');
print('✅ API call successful!');
print('City: ${weather.city}');
print('Temperature: ${weather.getTemperatureCelsius()}');
print('Description: ${weather.description}');
} catch (e) {
print('❌ API call failed: $e');
}
} else {
print('❌ API key not configured');
print('Please set your API key in lib/services/weather_service.dart');
}
}