Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
fwrhine committed Nov 22, 2020
1 parent a6f3db2 commit 6071250
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
21 changes: 9 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
```
4 changes: 3 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -26,7 +28,7 @@ class _HomeState extends State<Home> {
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'];
Expand Down

0 comments on commit 6071250

Please sign in to comment.