I'm sending response.body and country name with slash as like germany/ as parameter and converting it to Germany in parser and returning. But if i use parameter, i'm getting  error of the getter 'vacTotal' was called on null. If i write "Germany"to countryDataVac["Germany"] the code works correctly. Is it the problem on {"Global": new CountryDataVac()}? The default value is "Global".
main.dart:
  Map<String, CountryDataVac> countryDataVac = {"Global": new CountryDataVac()};
  static Map<String, CountryDataVac> getCountryDataVac(String body, var countryname) {
    Map<String, CountryDataVac> countryDataVac = {};
responseVac1Day = await http.get("https://disease.sh/v3/covid-19/vaccine/coverage?fullData=true&lastdays=1"); //vaccine number info
      countryDataVac = Parser.getCountryDataVac(responseVac1Day.body, "germany/"); //vaccine number info
Parser.dart:
var usera = CountryDataVac.fromJson(jsonDecode(result));
countryDataVac[capitalize(countryname).replaceAll("/", "")] = parseRowVac(usera.vacTotal,usera.vacDaily,usera.vactotalPerHundred,usera.vacdailyPerMillion); //gives 'germany/' as 'Germany' but getting error if i get the countryname by parameter
countryDataVac["Germany"] = parseRowVac(usera.vacTotal,usera.vacDaily,usera.vactotalPerHundred,usera.vacdailyPerMillion); //works
}
CountryDataVac.dart (created by json to dart)
import 'dart:convert';
List<CountryDataVac> countryDataVacFromJson(String str) => List<CountryDataVac>.from(json.decode(str).map((x) => CountryDataVac.fromJson(x)));
String countryDataVacToJson(List<CountryDataVac> data) => json.encode(List<dynamic>.from(data.map((x) => x.toJson())));
class CountryDataVac {
  CountryDataVac({
    this.vacTotal = 0,
    this.vacDaily = 0,
    this.vactotalPerHundred = 0,
    this.vacdailyPerMillion = 0,
    this.date = "",
  });
  int vacTotal = 0;
  int vacDaily = 0;
  int vactotalPerHundred = 0;
  int vacdailyPerMillion = 0;
  String date = "";
  factory CountryDataVac.fromJson(Map<String, dynamic> json) => CountryDataVac(
    vacTotal: json["total"],
    vacDaily: json["daily"],
    vactotalPerHundred: json["totalPerHundred"],
    vacdailyPerMillion: json["dailyPerMillion"],
    date: json["date"],
  );
  Map<String, dynamic> toJson() => {
    "total": vacTotal,
    "daily": vacDaily,
    "totalPerHundred": vactotalPerHundred,
    "dailyPerMillion": vacdailyPerMillion,
    "date": date,
  };
}
  
 
    