我想使用io示例(https://github.com/dart-lang/rpc)尝试Dart的rpc包
我在使用1.9.1 SDK的Dart编辑器的64位版本(无法更新超过稳定版本)
这是我的pubspec.yaml:
name: myDartRestServer
version: 0.0.1
description: A minimal command-line application.
#author: <your name> <[email protected]>
#homepage: https://www.example.com
environment:
sdk: '1.9.1'
dependencies:
rpc: any
dev_dependencies:
unittest: any
但是,当我尝试复制示例以启动服务器时:
final ApiServer _apiServer = new ApiServer('/api/', prettyPrint: true);
void start() {
_apiServer.addApi(new Synchro());
HttpServer server = await HttpServer.bind(InternetAddress.ANY_IP_V4, 9090);
server.listen(_apiServer.httpRequestHandler);
_apiServer.enableDiscoveryApi("http://localhost:9090");
}
我的EDI(SDK)不知道await关键字。(我将dart:io dart:async和rpc包导入到我的库文件中)
我错过了什么吗?预先感谢您的回复。祝你今天过得愉快。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句