I have a simple json file like below. This is fixed in the project.
{
"en": "English",
"es": "Espa?ol",
"fr": "Fran?ais"
}
My question is, is it possible to do a auto-generate work to create a class with members which return the value of each key? The result of the auto-generate can be similar to below example. So every time I add new key and value to the json file, this class will generate or update that new item into it.
class JsonHelper {
static String get en => json['en'];
static String get es => json['es'];
static String get fr => json['fr'];
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…