比较DART中第三个列表中的两个嵌套列表和商店差异
我有两个salesorderheader列表(让我们在之前和之后打电话),需要检查salessqty字段是否有差异。如果发现差异,则将其记录在第三个列表中(我们称之为差异)。据说需要比较的项目将处于相同的索引中,但是要谨慎,我希望salesid和itemrecid在计算差异之前匹配两个列表之间。
salesorderhheader.dart
class salesOrderHeader {
String? salesId = "";
List<SalesOrderLine>? salesOrderLine;
salesorderline.dart
class salesOrderLine {
String salesId = "";
int itemRecId = "";
String itemId = "";
String itemName = "";
double salesQty = 0.0;
I have two lists of salesOrderHeader (lets call them Before and After) and need to check if there is a difference on the salesQty field. If a difference is found it is recorded in a third list (lets call it Differences). Supposedly the items that need to be compared will be in the same index but to be prudent I'd like the salesId and itemRecId to match between the two lists before calculating the differences.
salesOrderhHeader.dart
class salesOrderHeader {
String? salesId = "";
List<SalesOrderLine>? salesOrderLine;
salesOrderLine.dart
class salesOrderLine {
String salesId = "";
int itemRecId = "";
String itemId = "";
String itemName = "";
double salesQty = 0.0;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这就是我设法做的,似乎有效,但我想知道是否有更好的答案。
This is what I managed to do, seems to work but I want to know if there is a better answer.