addConfigValues static method

Future<bool> addConfigValues(
  1. Map configValues
)

Implementation

static Future<bool> addConfigValues(Map configValues) async{
  bool result=false;
  String path=await rootAppDirectoryPath;
  path+="/"+_configPath;
  File configFile=new File(path);
  Map config=new HashMap();
  if(!configFile.existsSync()){
    configFile.createSync(recursive: true);
  }
  else{
    String configJson=configFile.readAsStringSync();
    config=jsonDecode(configJson);
  }
  configValues.forEach((key, value) {
    config[key]=value;
  });
  configFile.writeAsStringSync(jsonEncode(config));
  result=true;
  return result;
}