this piece of code
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"]??"",)),
);
}
worked previously, but now the test fails by throwing,
Failed to load "xxx/xxxx/the_country_number_test.dart": type 'Null' is not a subtype of type 'String'
the error is thrown while accessing j['DialCode']
('DialCode' property might not exist),
AFAIK accessing DialCode property by j['DialCode']
is giving me Null
object but how do i get away with using j['DialCode']??""
try to use
contains
like this