Flutter 和风天气插件
已有功能
x城市信息查询x热门城市查询xPOI信息搜索xPOI范围搜索x实时天气查询x逐天天气查询x逐时天气查询x中国地区未来2小时内每5分钟降水查询x当天生活指数查询x三天生活指数查询x天气灾害预警x灾害预警列表x空气质量实况x空气质量5天预报x历史天气x历史空气质量x日出日落x月升月落月相x太阳高度角x潮汐x潮流x台风列表x台风实况和路径x台风预报其他功能(好像没有了)
运行
注册账号 并 get 秘钥
首先你得有个和风天气的账号,去吧骚年。账号注册成功后在应用管理创建应用。注意包名别写错了哦。
本项目 example 的包名
Android:com.fluttercandies.flutter_qweather_example
ios: com.fluttercandies.flutterQweatherExample
初始化插件
QweatherConfig config = QweatherConfig(
publicIdForAndroid: 'HE210xxxxxxxxxxxxx',
keyForAndroid: '8453863xxxxxxxxxxxxxxxxxxxxxxxxxx',
publicIdForIos: 'HE210xxxxxxxxxxxxx',
keyForIos: 'aead742xxxxxxxxxxxxxxxxxxxxxxxxx',
biz: false,
debug: true);
await FlutterQweather.instance.init(config);
location 为 LocationID 或者 经纬度; LocationID 可通过geo 接口查询 或 查看https://github.com/qwd/LocationList
实时天气查询
String location = '116.41,39.92';
WeatherNow? _resp = await FlutterQweather.instance.getWeatherNow(location);
逐天天气查询
String location = '116.41,39.92';
WeatherDailyResp? _resp = await FlutterQweather.instance.getWeatherDaily(location, WeatherDailyForecast.WeatherForecast3Day);
逐时天气查询
String location = '116.41,39.92';
WeatherHourlyResp? _resp = await FlutterQweather.instance.getWeatherHourly(location, WeatherHourlyForecast.WeatherForecast24Hour);
中国地区未来2小时内每5分钟降水查询
String location = '116.41,39.92';
WeatherMinutelyResp? _resp = await FlutterQweather.instance.getWeatherMinuteLy(location);
其他接口....相信你能看懂怎么用
贡献代码
第一次写跟原生交互的插件,望各位大大多多指点,有写得不好的地方,请直接用 PR 来怼我。
