makeDefinesDartCodeFile function

bool makeDefinesDartCodeFile(
  1. File outFile,
  2. String? className,
  3. Map<String, dynamic> arbJson,
  4. List<I18nEntity> supportedLocale,
)

Implementation

bool makeDefinesDartCodeFile(
    File outFile, String? className, Map<String, dynamic> arbJson,List<I18nEntity> supportedLocale) {
  List<String> getters = [];
  arbJson.forEach((key, value) {
    if (key.startsWith('@')) {
      return;
    }
    getters.add(_makeGetterCode(value, key));
  });
  if (!outFile.existsSync()) {
    outFile.createSync();
  }
  String supportedLocaleCode = _makeSupportedLocaleCode(supportedLocale);
  String contentStr = _makeClassCodeString(className,supportedLocaleCode, getters.join());
  outFile.writeAsStringSync(contentStr);
  return true;
}