This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class MyIp { | |
| final _client = Client(); | |
| Future<String> get ipAddress async { | |
| final apiResult = await _client.get('https://api.ipify.org/?format=json'); | |
| return json.decode(apiResult.body)['ip']; | |
| } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class MyIp { | |
| MyIp(this._client); | |
| final Client _client; | |
| Future<String> get ipAddress async { | |
| final apiResult = await _client.get('https://api.ipify.org/?format=json'); | |
| return json.decode(apiResult.body)['ip']; | |
| } | |
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import 'dart:async'; | |
| import 'package:sqflite/sqflite.dart'; | |
| import 'package:reflectable/reflectable.dart'; | |
| Database db; | |
| /// A Model abstract class | |
| abstract class Model<T> { | |
| static String primaryKey; | |
| static String table; | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import 'dart:convert'; | |
| Map<String, dynamic> parseJwt(String token) { | |
| final parts = token.split('.'); | |
| if (parts.length != 3) { | |
| throw Exception('invalid token'); | |
| } | |
| final payload = _decodeBase64(parts[1]); | |
| final payloadMap = json.decode(payload); | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import 'package:flutter/material.dart'; | |
| import '../models/beer.dart'; | |
| class BeerTile extends StatelessWidget { | |
| final Beer _beer; | |
| BeerTile(this._beer); | |
| @override | |
| Widget build(BuildContext context) => Column( | |
| children: <Widget>[ | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | ... | |
| @override | |
| Widget build(BuildContext context) => Scaffold( | |
| appBar: AppBar( | |
| centerTitle: true, | |
| title: Text('Top Beers'), | |
| ), | |
| body: ListView.builder( | |
| itemCount: _beers.length, | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import '../repository/beer_repository.dart'; | |
| import '../models/beer.dart'; | |
| ... | |
| class _HomeState extends State<Home> { | |
| List<Beer> _beers = <Beer>[]; | |
| @override | |
| void initState() { | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import 'package:http/http.dart' as http; | |
| import 'dart:convert'; | |
| import '../models/beer.dart'; | |
| Future<Stream<Beer>> getBeers() async { | |
| final String url = 'https://api.punkapi.com/v2/beers'; | |
| final client = new http.Client(); | |
| final streamedRest = await client.send( | |
| http.Request('get', Uri.parse(url)) | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | dependencies: | |
| flutter: | |
| sdk: flutter | |
| cupertino_icons: ^0.1.2 | |
| http: ^0.12.0 | |
| dev_dependencies: | |
| flutter_test: | |
| sdk: flutter | |
| flutter: | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class Beer { | |
| final int id; | |
| final String name; | |
| final String tagline; | |
| final String description; | |
| final String image_url; | |
| Beer.fromJSON(Map<String, dynamic> jsonMap) : | |
| id = jsonMap['id'], | |
| name = jsonMap['name'], |