hashWithKey static method

String hashWithKey(
  1. String data,
  2. String secretKey
)

Implementation

static String hashWithKey(String data, String secretKey) {
  final key = utf8.encode(secretKey);
  final bytes = utf8.encode(data);
  final hmac = Hmac(sha256, key);
  final digest = hmac.convert(bytes);
  return digest.toString();
}