Запрос программирования Дарта: чтение ответа от GET


Допустим, у меня есть URL запроса = var url = " https://www.googleapis.com/books/v1/volumes?q=dart+java ";

При попадании я получаю ответ, подобный тому, который указан ниже. Если я хочу просто перечислить список названий из этого, как я могу это сделать в Dart?

Я хочу отображать для каждой книги в выпуске. Название Автор Издатель Дата публикации Описание

"kind": "books#volumes",
"totalItems": 1025,
"items": [
"kind": "books#volume",
"etag": "jnz5pApZSnA",
"selfLink": "https://www.googleapis.com/books/v1/volumes/ECGJMAEACAAJ",
"volumeInfo": {
"title": "Dart in Action",
"authors": [
"Chris Buckett"
"publisher": "Manning Publications",
"publishedDate": "2013",
"description": "Summary Dart in Action introduces Google Dart language and provides techniques and examples showing how to use it as a viable replacement for Java and JavaScript in browser-based desktop and mobile applications. It begins with a rapid overview of Dart language and tools, including features like interacting with the browser, optional typing, classes, libraries, and concurrency with isolates. After you master the core concepts, you'll move on to running Dart on the server and creating single page HTML5 web applications. About the Technology Dart is a web programming language developed by Google. It has modern OO features, just like Java or C#, while keeping JavaScript dynamic and functional characteristics. Dart applications are \"transpiled\" to JavaScript, and they run natively in Dart-enabled browsers. With production-quality libraries and tools, Dart operates on both the client and the server for a consistent development process. About this Book Dart in Action introduces the Dart language and teaches you to use it in browser-based, desktop, and mobile applications. Not just a language tutorial, this book gets quickly into the nitty-gritty of using Dart. Most questions that pop up while you're reading are answered on the spot! OO newbies will appreciate the gentle pace in the early chapters. Later chapters take a test-first approach and encourage you to try Dart hands-on. To benefit from this book you'll need experience with HTML and JavaScript?a Java or C# background is helpful but not required. Purchase of the print book comes with an offer of a free PDF, ePub, and Kindle eBook from Manning. Also available is all code from the book. What Inside Dart from the ground up Numerous code samples and diagrams Creating single-page web apps Transitioning from Java, C#, or JavaScript Running Dart in the browser and on the server About the Author Chris Buckett builds enterprise-scale web applications. He runs Dartwatch.com and is an active contributor to the dartlang list. \"Includes numerous examples of core language features as well as more advanced HTML5 features.\"—From the Foreword by Seth Ladd, Developer Advocate, Google Table of Contents PART 1 INTRODUCING DART Hello Dart \"Hello World\" with Dart tools Building and testing your own Dart app PART 2 CORE DART Functional first-class functions and closures Understanding libraries and privacy Constructing classes and interfaces Extending classes and interfaces Collections of richer classes Asynchronous programming with callbacks and futures PART 3 CLIENT-SIDE DART APPS Building a Dart web app Navigating offline data Communicating with other systems and languages PART 4 SERVER-SIDE DART Server interaction with files and HTTP Sending, syncing, and storing data Concurrency with isolates",
"industryIdentifiers": [
"type": "ISBN_10",
"identifier": "1617290866"
"type": "ISBN_13",
"identifier": "9781617290862"
"pageCount": 398,
"printType": "BOOK",
"categories": [
"averageRating": 3.0,
"ratingsCount": 1,
"contentVersion": "preview-1.0.0",
"imageLinks": {
"smallThumbnail": "http://bks9.books.google.co.in/books?id=ECGJMAEACAAJ&printsec=frontcover&img=1&zoom=5&source=gbs_api",
"thumbnail": "http://bks9.books.google.co.in/books?id=ECGJMAEACAAJ&printsec=frontcover&img=1&zoom=1&source=gbs_api"

спросил(а) 2013-12-06T13:31:00+04:00 6 лет, 7 месяцев назад

вы можете обработать его как

void main(List<String> x) {
var js = '''
... some JSON ...

Map d = JSON.decode(js);

var books = (d['items'] as List).forEach((Map item) {
print('Title: ${item['volumeInfo']['title']}');
if(item['volumeInfo']['authors'] != null) {
(item['volumeInfo']['authors'] as List).forEach((a) => print(' Author: ${a}'));

ответил(а) 2013-12-06T14:01:00+04:00 6 лет, 7 месяцев назад

Ты можешь сделать:

import 'dart:html';
import 'dart:convert';

.then((String fileContents) {
// parse the content with JSON and do what you want...
final json = JSON.decode(fileContents);
.catchError((Error error) {

ответил(а) 2013-12-06T13:38:00+04:00 6 лет, 7 месяцев назад
Ваш ответ
Введите минимум 50 символов
Чтобы , пожалуйста,
Выберите тему жалобы:

Другая проблема