tryGetAsCode function
Implementation
String? tryGetAsCode(value) {
if (value is String) {
final escaped = escapeString(value);
return escaped;
} else if (value is bool) {
return '$value';
} else if (value is num) {
return '$value';
} else if (value == null) {
return '$value';
} else if (value is List) {
final values = [];
for (var item in value) {
final code = tryGetAsCode(item);
values.add(code);
}
return '[${values.join(', ')}]';
}
return null;
}