isValidAttribute static method

bool isValidAttribute({
  1. required Attribute attribute,
})

Implementation

static bool isValidAttribute({
  required Attribute attribute,
}) {
  try {
    final regex = RegExp(r'^(?!\$)[a-zA-Z0-9_-]+$');
    return regex.hasMatch(attribute.key ?? '') &&
        (attribute.key?.isNotEmpty ?? false) &&
        ((attribute.key?.length ?? 0) <= 40) &&
        ((attribute.value?.length ?? 0) <= 250);
  } catch (e) {
    SdkLogger.error('Inappify attribute validation failed: ${e.runtimeType}');
    return false;
  }
}