this might take a while... I've been trying to get my Dart/Flutter code to return data from BlockChainTicker (Specifically I would like to see everything from the AUD line) and leave this in the Debug Console. When I do so, I get this error back from the Console
E/flutter ( 8656): [ERROR:topaz/lib/tonic/logging/dart_error.cc(16)] Unhandled exception:
E/flutter ( 8656): type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'List' where
E/flutter ( 8656): _InternalLinkedHashMap is from dart:collection
E/flutter ( 8656): String is from dart:core
E/flutter ( 8656): List is from dart:core
My code might seem amature but I only have about a weeks experience in this language, so thanks for any patience you might take in reading over this.
import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
class First extends StatefulWidget {
@override
HomePageState createState() => new HomePageState();
}
class HomePageState extends State<First> {
List data;
Future<String> getData() async {
var response = await http.get(
Uri.encodeFull("http://blockchain.info/ticker"),
headers: {
"Accept": "application/json"
}
);
data = JSON.decode(response.body);
print(data[1]["AUD"]);
return "Success!";
}
@override
Widget build(BuildContext context) {
return new Scaffold(
body: new Center(
child: new RaisedButton(
child: new Text("Get data"),
onPressed: getData,
),
),
);
}
}