这段代码
static fromJson(Map<String, dynamic> j) {
return _TheCountry(
name: j["Name"]??"",
dialCode: j["DialCode"]??"",
iso2Code: j["Iso2"]??"",
englishName: j["EnglishName"]??"",
iso3Code: j["Iso3"]??"",
currency: j["Currency"]??"",
capital: j["Capital"]??"",
dialLengths: List.castFrom(getDialLengths(j["DialLength"]??"",)),
);
}
以前工作过,但现在测试因抛出而失败,
Failed to load "xxx/xxxx/the_country_number_test.dart": type 'Null' is not a subtype of type 'String'
访问时抛出错误j['DialCode']
('DialCode' 属性可能不存在),AFAIK 访问 DialCode 属性j['DialCode']
给了我Null
对象,但我如何摆脱使用j['DialCode']??""