Created with <3 with dartpad.dev.
Created
November 16, 2022 05:51
-
-
Save hongsw/18179793327521f3ed0d772a712d0adc to your computer and use it in GitHub Desktop.
3.3 웹에서 가져와서 보여주기
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 'package:flutter/material.dart'; | |
void main() async { | |
var jsonDomain = "gist.githubusercontent.com"; | |
var jsonUrl = "hongsw/bda2f942a8a8c32f5cd0a49b5650b062/raw/01c789addcab42ed3ff6e8587b21f31c92abd55c/webtoon.json"; | |
var response = await http.get(Uri.https(jsonDomain,jsonUrl)); | |
var toons = json.decode(utf8.decode(response.bodyBytes)); | |
runApp(MaterialApp( | |
home: Scaffold( | |
appBar: AppBar(title: const Text("내폰내툰")), | |
body: Row( | |
children: toons.map<Widget>((item) => | |
Column(children: [ | |
Image.network(item['image']!), | |
Text(item['title']!)]), | |
).toList() | |
)))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment