parseTextData function
Implementation
String parseTextData(String data, Map<String, dynamic> qsParams,
{int? maxLength}) {
if (data.contains('\$.')) {
String dataEx = replaceStringJsonPath(data, qsParams);
dataEx = LocalizedMessageRepository().getLocalizedMessages(dataEx) ?? data;
// Check if maxLength is provided and the length of the text exceeds maxLength
if (maxLength != null && dataEx.length > maxLength) {
// Truncate the text and add ellipsis
return '${dataEx.substring(0, maxLength)}...';
} else {
return dataEx;
}
}
data = LocalizedMessageRepository().getLocalizedMessages(data) ?? data;
// Check if maxLength is provided and the length of the text exceeds maxLength
if (maxLength != null && data.length > maxLength) {
// Truncate the text and add ellipsis
return '${data.substring(0, maxLength)}...';
} else {
return data;
}
}