open_weather_map_client

Last updated:

0 purchases

open_weather_map_client Image
open_weather_map_client Images
Add to Cart

Description:

open weather map client

Open Weather Map Client #
Package that communicates with Open Weather Map to obtain climate data in a model.
Getting Started #

Get the current weather #
See the full example at: https://github.com/astudilloalex/flutter-open-weather-map-client/tree/main/example
FutureBuilder<CurrentWeather>(
future: openWeatherMap.currentWeather(const City(name: 'London')),
builder: (_, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(child: CircularProgressIndicator.adaptive());
}
if (snapshot.hasError) {
return ApiErrorCard(apiError: snapshot.error! as ApiError);
}
if (!snapshot.hasData) {
return const Center(
child: Text(
'Error obtained data, check internet connection',
),
);
}
final CurrentWeather weather = snapshot.data!;
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Text('City: ${weather.city.name}'),
Text('Temperature: ${weather.detail.temperatureCelsius.toStringAsFixed(2)} °C'),
Text('Speed: ${weather.wind.speed.toStringAsFixed(2)} m/s'),
],
),
);
},
),
copied to clipboard

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.