buildMessage function

String buildMessage(
  1. String message,
  2. String? attribute, [
  3. String? extra
])

Implementation

String buildMessage(String message, String? attribute, [String? extra]) {
  if (attribute != null) {
    return message.replaceAll("field", attribute.toLowerCase());
  }
  if (extra != null) {
    return message.replaceAll("extra", extra.toLowerCase());
  }
  if (attribute != null && extra != null) {
    return message
        .replaceAll("field", attribute.toLowerCase())
        .replaceAll("extra", extra);
  }
  return message;
}