From 6071250b8be29b8bdd0c30ab5ea5b0d4563d4a1c Mon Sep 17 00:00:00 2001 From: fwrhine Date: Sun, 22 Nov 2020 12:36:01 +1000 Subject: [PATCH] Update README.md --- README.md | 21 +++++++++------------ lib/main.dart | 4 +++- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index e7b8b35..75f9441 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,13 @@ -# weather_app +# Weather App -A new Flutter application. +A simple weather app. -## Getting Started +## Running the project -This project is a starting point for a Flutter application. +Replace the variable `apiKey` in `main.dart` with your API key from [OpenWeatherMap](https://openweathermap.org/). -A few resources to get you started if this is your first Flutter project: - -- [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab) -- [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook) - -For help getting started with Flutter, view our -[online documentation](https://flutter.dev/docs), which offers tutorials, -samples, guidance on mobile development, and a full API reference. +## Dependencies +``` +font_awesome_flutter: ^8.10.0 +http: ^0.12.2 +``` \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index b2f89b2..a46cc5e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -3,6 +3,8 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:http/http.dart' as http; import 'dart:convert'; +String apiKey = "your API key here"; + void main () => runApp( MaterialApp( title: "Weather App", @@ -26,7 +28,7 @@ class _HomeState extends State { var windSpeed; Future getWeather () async { - http.Response response = await http.get("http://api.openweathermap.org/data/2.5/weather?q=Brisbane&units=metric&appid=142286faa5bd8ccf1ae8df60bef70179"); + http.Response response = await http.get("http://api.openweathermap.org/data/2.5/weather?q=Brisbane&units=metric&appid=" + apiKey); var results = jsonDecode(response.body); setState(() { this.temp = results['main']['temp'];