assertPermission method

void assertPermission(
  1. String domain, [
  2. Object? data
])

Check if a permission is granted, otherwise throw an exception.

Implementation

void assertPermission(String domain, [Object? data]) {
  if (!checkPermission(domain, data)) {
    throw Exception(
        "Permission '$domain' denied${data == null ? '' : " for '$data'"}.\n"
        "To grant permissions, use Runtime.grant() or add the permission "
        "to the permissions array of your HotSwapLoader, EvalWidget, "
        "or eval() function.");
  }
}