cacheGetterCodeForField function

String cacheGetterCodeForField (FieldElement field)

Implementation

String cacheGetterCodeForField(FieldElement field) {
  var code = null;
  switch (field.type.displayName) {
    case 'bool':
      code = 'return _cache["${field.name}"] as bool;';
      break;
    case 'int':
      code = 'return _cache["${field.name}"] as int;';
      break;
    case 'String':
      code = 'return _cache["${field.name}"] as String;';
      break;
    case 'List<String>':
      code = 'return List<String>.from(_cache["${field.name}"] as List);';
      break;
    case 'double':
      code = 'return _cache["${field.name}"] as double;';
      break;
  }
  return code;
}