Angular Dart:使用API​​获取库存Feed

时间:2018-12-04 11:30:45

标签: dart angular-dart dart-pub dart-html

  

正在寻找Angular-Dart的解决方案,该解决方案允许从http或websocket获取API json数据。 https://iextrading.com/developer/docs/#websockethttps://iextrading.com/developer/docs/#http-methodshttps://www.alphavantage.co/documentation/   从Newbee到Dart网站;)

import 'package:http/http.dart' as http;
import 'dart:async';
const socket = require('socket.io-client')('https://ws-api.iextrading.com   /1.0/tops')

class StockService {

Future<double> getPrice(String symbol) async {
String url = "https://api.iextrading.com/1.0/stock/${symbol}/price";

http.Response response = await http.get(url);

test('Intraday', () async {
  final timeSeries = new TimeSeries("YourAlphaVantageAPIKey");
  JSONObject json = await timeSeries.getIntraday("MSFT");

  // Use get method to search entire json for key for stock
  expect(json.get("2. Symbol"), "MSFT");

<table>
<tr ngFor="let price of prices">
<td>{{ quotes.symbol }}</td>
<td>{{ quotes.price }}</td>
</tr>

0 个答案:

没有答案