Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/dart/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 导入模式类时有状态小部件出错_Flutter_Dart - Fatal编程技术网

Flutter 导入模式类时有状态小部件出错

Flutter 导入模式类时有状态小部件出错,flutter,dart,Flutter,Dart,当我不导入模式文件时,代码工作正常 当我导入一个模式dart文件时,有状态的小部件变成了警告线,使我无法构建项目 下面是我的modal.dart class Merchant { int id; String type; String name; String image; String address1; String address2; String address3; String city; String stateCode; String p

当我不导入模式文件时,代码工作正常

当我导入一个模式dart文件时,有状态的小部件变成了警告线,使我无法构建项目

下面是我的modal.dart

class Merchant {


int id;
  String type;
  String name;
  String image;
  String address1;
  String address2;
  String address3;
  String city;
  String stateCode;
  String postcode;
  String countryCode;
  int priority;
  String createdAt;
  String updatedAt;
  String deletedAt;
  String email;
  String contact;
  String slug;
  String emailFinance;
  int isEmailFinance;
  String legalName;
  String legalRegistrationNumber;
  String bankSwiftCode;
  String bankAccountNumber;
  String imageUrl;
  String address;
  String merchantType;
  List<Currencies> currencies;
  State state;
  Country country;

  Merchant(
      {this.id,
        this.type,
        this.name,
        this.image,
        this.address1,
        this.address2,
        this.address3,
        this.city,
        this.stateCode,
        this.postcode,
        this.countryCode,
        this.priority,
        this.createdAt,
        this.updatedAt,
        this.deletedAt,
        this.email,
        this.contact,
        this.slug,
        this.emailFinance,
        this.isEmailFinance,
        this.legalName,
        this.legalRegistrationNumber,
        this.bankSwiftCode,
        this.bankAccountNumber,
        this.imageUrl,
        this.address,
        this.merchantType,
        this.currencies,
        this.state,
        this.country});

  Merchant.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    type = json['type'];
    name = json['name'];
    image = json['image'];
    address1 = json['address1'];
    address2 = json['address2'];
    address3 = json['address3'];
    city = json['city'];
    stateCode = json['state_code'];
    postcode = json['postcode'];
    countryCode = json['country_code'];
    priority = json['priority'];
    createdAt = json['created_at'];
    updatedAt = json['updated_at'];
    deletedAt = json['deleted_at'];
    email = json['email'];
    contact = json['contact'];
    slug = json['slug'];
    emailFinance = json['email_finance'];
    isEmailFinance = json['is_email_finance'];
    legalName = json['legal_name'];
    legalRegistrationNumber = json['legal_registration_number'];
    bankSwiftCode = json['bank_swift_code'];
    bankAccountNumber = json['bank_account_number'];
    imageUrl = json['image_url'];
    address = json['address'];
    merchantType = json['merchant_type'];
    if (json['currencies'] != null) {
      currencies = new List<Currencies>();
      json['currencies'].forEach((v) {
        currencies.add(new Currencies.fromJson(v));
      });
    }
    state = json['state'] != null ? new State.fromJson(json['state']) : null;
    country =
    json['country'] != null ? new Country.fromJson(json['country']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['type'] = this.type;
    data['name'] = this.name;
    data['image'] = this.image;
    data['address1'] = this.address1;
    data['address2'] = this.address2;
    data['address3'] = this.address3;
    data['city'] = this.city;
    data['state_code'] = this.stateCode;
    data['postcode'] = this.postcode;
    data['country_code'] = this.countryCode;
    data['priority'] = this.priority;
    data['created_at'] = this.createdAt;
    data['updated_at'] = this.updatedAt;
    data['deleted_at'] = this.deletedAt;
    data['email'] = this.email;
    data['contact'] = this.contact;
    data['slug'] = this.slug;
    data['email_finance'] = this.emailFinance;
    data['is_email_finance'] = this.isEmailFinance;
    data['legal_name'] = this.legalName;
    data['legal_registration_number'] = this.legalRegistrationNumber;
    data['bank_swift_code'] = this.bankSwiftCode;
    data['bank_account_number'] = this.bankAccountNumber;
    data['image_url'] = this.imageUrl;
    data['address'] = this.address;
    data['merchant_type'] = this.merchantType;
    if (this.currencies != null) {
      data['currencies'] = this.currencies.map((v) => v.toJson()).toList();
    }
    if (this.state != null) {
      data['state'] = this.state.toJson();
    }
    if (this.country != null) {
      data['country'] = this.country.toJson();
    }
    return data;
  }
}

class Currencies {
  int id;
  int merchantId;
  String code;
  String name;
  String createdAt;
  String updatedAt;
  Null deletedAt;
  String balanceCacheType;

  Currencies(
      {this.id,
        this.merchantId,
        this.code,
        this.name,
        this.createdAt,
        this.updatedAt,
        this.deletedAt,
        this.balanceCacheType});

  Currencies.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    merchantId = json['merchant_id'];
    code = json['code'];
    name = json['name'];
    createdAt = json['created_at'];
    updatedAt = json['updated_at'];
    deletedAt = json['deleted_at'];
    balanceCacheType = json['balance_cache_type'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['merchant_id'] = this.merchantId;
    data['code'] = this.code;
    data['name'] = this.name;
    data['created_at'] = this.createdAt;
    data['updated_at'] = this.updatedAt;
    data['deleted_at'] = this.deletedAt;
    data['balance_cache_type'] = this.balanceCacheType;
    return data;
  }
}

class State {
  int id;
  String iso;
  String iso3;
  String name;
  String nameAlternate;
  String type;
  String code;

  State(
      {this.id,
        this.iso,
        this.iso3,
        this.name,
        this.nameAlternate,
        this.type,
        this.code});

  State.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    iso = json['iso'];
    iso3 = json['iso3'];
    name = json['name'];
    nameAlternate = json['name_alternate'];
    type = json['type'];
    code = json['code'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['iso'] = this.iso;
    data['iso3'] = this.iso3;
    data['name'] = this.name;
    data['name_alternate'] = this.nameAlternate;
    data['type'] = this.type;
    data['code'] = this.code;
    return data;
  }
}

class Country {
  int id;
  String iso;
  String name;
  String iso3;
  int numcode;
  int phonecode;

  Country(
      {this.id, this.iso, this.name, this.iso3, this.numcode, this.phonecode});

  Country.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    iso = json['iso'];
    name = json['name'];
    iso3 = json['iso3'];
    numcode = json['numcode'];
    phonecode = json['phonecode'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['iso'] = this.iso;
    data['name'] = this.name;
    data['iso3'] = this.iso3;
    data['numcode'] = this.numcode;
    data['phonecode'] = this.phonecode;
    return data;
  }
}
类商户{
int-id;
字符串类型;
字符串名;
字符串图像;
字符串地址1;
字符串地址2;
字符串地址3;
字符串城市;
字符串状态码;
字符串邮政编码;
字符串国家代码;
int优先级;
字符串createdAt;
字符串更新数据;
字符串deletedAt;
字符串电子邮件;
弦接触;
管段塞;
金融学;
国际金融;
字符串legalName;
字符串legalRegistrationNumber;
字符串银行SWIFTCODE;
银行帐号字符串;
字符串imageUrl;
字符串地址;
字符串商品类型;
列出货币;
国家;
国家;
商人(
{this.id,
这个.类型,,
这个名字,
这个,这个形象,,
这个地址是,
这个地址是,
这是第3条,
这个城市,
这是国家代码,
这是邮政编码,
这个国家代码,
这个,优先,,
这个.createdAt,
这个.updatedAt,
这个.deletedAt,
这是一封电子邮件,
这个,联系,,
这个,鼻涕虫,
这是一家金融公司,
这是我的财务,
这是我的名字,
此.legalRegistrationNumber,
这个.bankSwiftCode,
这是银行帐号,
这个.imageUrl,
这个地址,
这个.merchantType,
这就是货币,
这个州,
这个国家});
Merchant.fromJson(映射json){
id=json['id'];
type=json['type'];
name=json['name'];
image=json['image'];
address1=json['address1'];
address2=json['address2'];
address3=json['address3'];
city=json['city'];
stateCode=json['state_code'];
postcode=json['postcode'];
countryCode=json['country_code'];
优先级=json['priority'];
createdAt=json['created_at'];
updatedAt=json['updated_at'];
deletedAt=json['deleted_at'];
email=json['email'];
contact=json['contact'];
slug=json['slug'];
emailFinance=json['email_finance'];
isEmailFinance=json['is_email_finance'];
legalName=json['legal_name'];
legalRegistrationNumber=json['legal_registration_number'];
bankSwiftCode=json['bank_swift_code'];
bankAccountNumber=json['bank_account_number'];
imageUrl=json['image_url'];
address=json['address'];
merchantType=json['merchant_type'];
如果(json['Currences']!=null){
货币=新列表();
json['Currences'].forEach((v){
货币.add(新货币.fromJson(v));
});
}
state=json['state']!=null?新状态。fromJson(json['state']):null;
国家=
json['country']!=null?新国家。fromJson(json['country']):null;
}
映射到JSON(){
最终地图数据=新地图();
数据['id']=this.id;
数据['type']=this.type;
数据['name']=this.name;
数据['image']=this.image;
数据['address1']=this.address1;
数据['address2']=this.address2;
数据['address3']=this.address3;
数据['city']=本市;
数据['state_code']=this.stateCode;
数据['postcode']=this.postcode;
数据['country_code']=此.countryCode;
数据['priority']=此.priority;
数据['created_at']=this.createdAt;
数据['updated_at']=this.updatedAt;
数据['deleted_at']=this.deletedAt;
数据['email']=this.email;
数据['contact']=this.contact;
数据['slug']=this.slug;
数据['email_finance']=this.emailFinance;
数据['is_email_finance']=this.isEmailFinance;
数据['legal_name']=this.legalName;
数据['legal_registration_number']=this.legal RegistrationNumber;
数据['bank\U swift\U code']=this.bankSwiftCode;
数据['bank\u account\u number']=此.bankAccountNumber;
数据['image_url']=this.imageUrl;
数据['address']=此地址;
数据['merchant_type']=this.merchantType;
如果(this.currences!=null){
data['currences']=this.currences.map((v)=>v.toJson()).toList();
}
如果(this.state!=null){
data['state']=this.state.toJson();
}
如果(this.country!=null){
data['country']=this.country.toJson();
}
返回数据;
}
}
类别货币{
int-id;
国际贸易署;
字符串代码;
字符串名;
字符串createdAt;
字符串更新数据;
空deletedAt;
字符串平衡类型;
货币(
{this.id,
这是merchantId,
这个代码,
这个名字,
这个.createdAt,
这个.updatedAt,
这个.deletedAt,
此.balanceCacheType});
currences.fromJson(映射json){
id=json['id'];
merchantId=json['merchant_id'];
code=json['code'];
name=json['name'];
createdAt=json['created_at'];
updatedAt=json['updated_at'];
deletedAt=json['deleted_at'];
balanceCacheType=json['balance_cache_type'];
}
映射到JSON(){
最终地图数据=新地图();
数据['id']=this.id;
数据['merchant_id']=this.merchantId;
数据['code']=this.code;
数据['name']=this.name;
数据['created_at']=this.createdAt;
数据['updated_at']=this.updatedAt;
数据['deleted_at']=this.deletedAt;
数据['balance\u cache\u type']=this.balanceCacheType;
返回数据;
}
}
阶级国家{
int-id;
字符串iso;
字符串iso3;
字符串名;
字符串名称替换;
字符串类型;
字符串代码;
陈述(
{this.id,
这个.iso,
这是iso3,
这个名字,
这是我的名字,
这个.类型,,
此代码为});
State.fromJson(映射json){
id=json['id'];
iso=json['iso'];
iso3=json['iso3'];
name=json['name'];
nameAlternate=json['name_alternate'];
type=json['type'];
code=json['code'];
}
映射到JSON(){
最终地图数据=新地图();
数据['id']=this.id;
数据['iso']=这个。