generateCodeForFile method

String generateCodeForFile(
  1. String? filePath,
  2. ClassElement classElement,
  3. String jsonString,
  4. String? configName,
)

Implementation

String generateCodeForFile(String? filePath, ClassElement classElement,
    String jsonString, String? configName) {
  if (filePath == null) {
    throw 'configFiles must have a valid path and configName parameter! Offending Element: $classElement';
  }
  try {
    final Map<String, dynamic> parsedConfig = json.decode(jsonString);

    if (configName == null) {
      throw 'configFiles must have a valid path and configName parameter! Offending Element: $classElement';
    }
    return generateField(configName, classElement, parsedConfig, filePath);
  } on FormatException {
    print("invalid json for file $filePath!");
    rethrow;
  }
}