getErrorMessage method
Returns the error message with optional replacement.
The message
parameter represents the original error message.
The replacement
parameter is an optional string that can be used to replace the placeholder '{0}' in the error message.
If replacement
is provided, the placeholder '{0}' in the error message will be replaced with the replacement
string.
If replacement
is not provided, the original error message will be returned as is.
Implementation
String getErrorMessage(String message, [String? replacement]) {
final msg = errorMessage ?? message;
return replacement != null ? msg.replaceAll('{0}', replacement) : msg;
}