- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我一直在使用RCP客户端来处理天气数据。
我要做的是两件事,首先我将要使用的JSON抓取到了dart文件中。另请:https://dartpad.dartlang.org/a9c1fe8ce34c608eaa28
我的server.dart页面将导入天气数据,然后执行以下操作:
import "dart:io";
import "weather_data.dart";
import "dart:convert";
import "package:rpc/rpc.dart";
find ApiServer _apiServer = new ApiServer(prettyPrint:true);
main() async {
Weather w = new Weather(WeatherJson);
TestServer ts = new TestServer(w);
_apiServer.addApi(ts);
HttpServer server = await HttperServer.bind(InternetAddress.ANY_IP_V4, 12345);
server.listen(_apiServer.httpRequestHandler);
}
class Weather{
Map weather;
Weather(this.weather){
Map get daily => weather["daily"];
}
}
@ApiClass(name:"test_server", version: 'v1', description: 'This is a test server api to ping for some quick sample data.')
class TestServer {
Weather myWeather;
TestServer(this.myWeather){
}
@ApiMethod(method:'GET', path: 'daily')
Map<String, Object> getDaily(){
return myWeather.daily;
}
}
localhost:12345/test_server/v1/daily
,它将返回此代码:
{
"summary": {},
"icon": {},
"data": {}
}
Map<String, Object>
吗?我试图将其设置为:
Map<String, dynamic>
,但是dart编译器不喜欢它。
Map<String,Object>
不够,试图将其设置为
Map
。
Map
,
Map<String, Object>
和
Map<String, dynamic>
。
最佳答案
在https://pub.dartlang.org/packages/rpc中快速浏览了RPC软件包README之后,似乎标记为Api方法的方法(使用@ApiMethod)应该返回具有简单字段的类的实例,例如:
class ResourceMessage {
int id;
String name;
int capacity;
}
The MyResponse class must be a non-abstract class with an unnamed constructor taking no required parameters. The RPC backend will automatically serialize all public fields of the the MyResponse instance into JSON ...
Map
表示形式,并且会猜测RPC包未按您期望的方式处理它。
This leads me to believe something is wrong with the Parsing tool as it seems the return type in dartpad allows to return Map, Map, and Map.
Map
,
List
和
String
,其结构与从其派生的JSON相同。它恰好看起来像JSON。
data['daily']
),该子映射会打印出通过调用
String
生成的
toString()
-这是递归的,因此您可以获取所有嵌套映射的内容以及其中的列表。
toString()
和RPC代码如何处理一组嵌套映射的差异。
getDaily()
方法的返回类型无关紧要。无论方法的声明返回类型如何,返回的只是
Map
。请记住,Dart中的类型是可选的,编辑器和编译器在那里可以发现潜在的错误代码。参见
https://www.dartlang.org/docs/dart-up-and-running/ch02.html#variables。
关于json - 我的RCP客户端未返回对象的深拷贝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36163029/
我继续阅读 http://eclipse.geekyramblings.net/2010/12/14/preventing-multiple-instances/关于如何防止启动多个 RCP 实例。但
是否可以在基于 RCP 的应用程序中动态更改关于对话框文本?当关于对话框打开时,我想通过动态更改其文本的某些部分来替换 aboutText 值。问题是我有一个客户端/服务器应用程序,其中有关客户端的信
背景 我正在为 uDig 开发一个插件,这是一个基于 Eclipse RCP 构建的项目。我的插件包含一个表格,其中填充了来自 Workbench 选择的数据。用户可以对表格数据进行分组、排序和过滤。
我在重新启动 RCP 应用程序时遇到问题。当我在 Eclipse 下运行时一切正常,但是当我创建独立应用程序方法时重启只需关闭应用程序。我使用下一个代码: IWorkbench 工作台 = Platf
我已经编写了一个 RCP 应用程序。为此,我想使用 log4j 添加日志记录。 有人能提出解决方案吗? 我已经尝试过 this , 但我无法使用它。 感谢任何帮助! 最佳答案 考虑使用 Eclipse
我想在代码中调用 RCP 命令,如下所示: IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
我刚刚开始玩 Eclipse RCP。 我想完成的一些事情: 如何最大化应用程序的初始大小? 我想在我的左边创建一个侧边栏类型 View ,并想固定该 View 的大小并删除任何标题栏,从该侧边栏最小
我目前使用的是 Eclipse Helios Service Release 1。我是 IDE 和平台的新手。 我的问题是,如何在我的应用程序上获得与 IDE 相同的曲线选项卡? 最佳答案 根据 th
在Eclipse RCP中开发“关于窗口”时,我们需要定义: aboutText =我的文本,将在“关于”窗口中显示 在about.ini文件中。 我需要添加在概述页面中定义的版本号 .product
我使用 eclipse kepler(RCP 和 RAP 开发人员的 Eclipse)开发了一个 rcp 产品,但是设置选项卡样式不起作用。我尝试了两种方式 1.config.xml
我创建了一个简单的 Eclipse RCP 应用程序,我可以在其中根据用户操作打开多个编辑器实例。我有一个单独的 View (ViewPart),我在其中监听编辑器上的选择更改。问题是 View 仅被
我有一个 RCP 应用程序。它的默认透视图在编辑器区域的左侧和底部打开两个 View 。选项 SaveAndRestore 设置为 true。下次启动应用程序时,两个 View 都会关闭。为什么?我做
我正在构建一个基于 Eclipse RCP 的产品,我遇到了一个问题,当我尝试使用内置 p2 UI 安装产品更新时,我在对话框中收到一条错误消息“访问权限不足应用此更新。” 我已经调试到 Eclips
我开发了一个 Eclipse RCP 应用程序,我正在从我自己的 Java 程序中调用它。 当我从命令提示符(windows)运行我自己的 Java 程序时,它完美地工作并给出结果。 但是当我在 ec
我想知道是否可以(以及如何)将文件添加到 Eclipse RCP 应用程序的根目录。 我有一个 AppManual.pdf,我想在应用程序的根目录中分发。 最佳答案 退房 http://help.ec
是否可以在我的 Eclipse-RCP 产品中覆盖内置透视图的布局? 特别是,我希望添加一个自定义 View 并更改 Debug 透视图的布局。我知道如何使用自定义透视图 (IPerspectiveF
我必须开发一个简单的基于 Eclipse 的应用程序。我使用 Luna Eclipse RCP IDE(4.4)。我想有没有声明性的方式来启动我的应用程序,主窗口的大小最大化。 提前致谢 最佳答案 您
我想开始一个新项目,它将广泛使用插件。我知道 Eclipse 和 Netbeans 都有各自的富客户端平台,各有优缺点。 我想要一些 Stack Overflow 社区喜欢的评论。 此外,最重要的是,
有没有办法强制 RCP 产品在每次 RCP 被关注时显示欢迎页面? (默认情况下,仅在第一次启动 RCP 时才会显示欢迎页面。) 我在plugin_customization.ini中尝试了org.e
我尝试在 Eclipse RCP 应用程序中使用 classmexer,但我只得到一个 IllegalStateException: java.lang.IllegalStateException:
我是一名优秀的程序员,十分优秀!