如何解决此sqlite获取数据问题?

时间:2019-03-22 07:47:17

标签: dart flutter

错误消息是:未处理的异常:NoSuchMethodError:类'Data'没有实例方法'[]'。

 for (int i = 0; i < length; i++) {
    if (localData[i].syn_TableName == model.data[i].syn_TableName) {
      if (localData[i].syn_ChangeSequence != model.data[i].syn_ChangeSequence) {
        switch (i) {
          case 21:
            {
              storeRegister(url, token);
            }
            break;
        }
      }
    }
  }

这是我的模型类,如何使用API​​通过原始值获取原始

  class Data {
      final String syn_TableName;
      fi

nal int syn_ChangeSequence;

  Data({this.syn_TableName, this.syn_ChangeSequence});

  factory Data.fromJson(Map<String, dynamic> json) {
    return Data(
      syn_TableName: json['syn_TableName'],
      syn_ChangeSequence: json['syn_ChangeSequence'],
    );
  }

  Map<String, dynamic> toMap() {
    return {
      'syn_TableName': syn_TableName,
      'syn_ChangeSequence': syn_ChangeSequence
    };
  }
}

0 个答案:

没有答案