apiverve_gasprices 1.2.6
apiverve_gasprices: ^1.2.6 copied to clipboard
Gas Prices returns average retail gasoline, diesel and LPG prices from official weekly government surveys for the US, the UK, all 27 EU countries and the EU average. Pass a country, or a US state, reg [...]
Gas Prices API - Dart/Flutter Client #
Gas Prices returns average retail gasoline, diesel and LPG prices from official weekly government surveys for the US, the UK, all 27 EU countries and the EU average. Pass a country, or a US state, region or city, to get the latest week with week-over-week and year-over-year changes, in any currency, per liter or per gallon.
This is the Dart/Flutter client for the Gas Prices API.
Installation #
Add this to your pubspec.yaml:
dependencies:
apiverve_gasprices: ^1.2.6
Then run:
dart pub get
# or for Flutter
flutter pub get
Usage #
import 'package:apiverve_gasprices/apiverve_gasprices.dart';
void main() async {
final client = GaspricesClient('YOUR_API_KEY');
try {
final response = await client.execute({
'country': 'US',
'area': 'CA',
'currency': 'USD',
'unit': 'liter',
'date': '2024-06-15'
});
print('Status: ${response.status}');
print('Data: ${response.data}');
} catch (e) {
print('Error: $e');
}
}
Response #
{
"status": "ok",
"error": null,
"data": {
"country": "US",
"countryName": "United States",
"area": "US",
"areaName": "United States",
"areaType": "national",
"week": "2026-09-28",
"currency": "USD",
"unit": "gallon",
"prices": {
"regular": 4.465,
"midgrade": 5.073,
"premium": 5.482,
"diesel": 6.382,
"allGrades": 4.603,
"lpg": null
},
"changeDirection": "down",
"previousWeek": "2026-09-21",
"weeklyChange": {
"regular": -0.013,
"midgrade": 0.012,
"premium": 0.022,
"diesel": -0.147,
"allGrades": -0.007,
"lpg": null
},
"yearAgoWeek": "2025-09-29",
"yearlyChange": {
"regular": 1.347,
"midgrade": 1.366,
"premium": 1.415,
"diesel": 2.628,
"allGrades": 1.355,
"lpg": null
},
"nativeCurrency": "USD",
"nativeUnit": "gallon",
"exchangeRate": 1
}
}
API Reference #
- API Home: Gas Prices API
- Documentation: docs.apiverve.com/ref/gasprices
Authentication #
All requests require an API key. Get yours at apiverve.com.
License #
MIT License - see LICENSE for details.
Built with Dart for APIVerve