getValidationErrorMessage method

String getValidationErrorMessage(
  1. ValidationResult result
)

Get error message for validation result

Implementation

String getValidationErrorMessage(ValidationResult result) {
  try {
    final lib = PlatformLoader.loadCommons();
    final getMsgFn = lib.lookupFunction<Pointer<Utf8> Function(Int32),
        Pointer<Utf8> Function(int)>('rac_validation_error_message');

    final msgResult = getMsgFn(result.code);
    if (msgResult == nullptr) return result.message;
    return msgResult.toDartString();
  } catch (e) {
    return result.message;
  }
}