hex static method

String hex(
  1. Object? value, {
  2. int limit = maxValueBytes,
  3. bool empty = true,
})

Implementation

static String hex(
  Object? value, {
  int limit = maxValueBytes,
  bool empty = true,
}) {
  if (value is! String ||
      value.length > limit * 2 ||
      (!empty && value.isEmpty) ||
      !RegExp(r'^(?:[0-9a-fA-F]{2})*$').hasMatch(value)) {
    throw const FormatException(
      'Expected bounded, even-length BLE hex data.',
    );
  }
  return value.toLowerCase();
}