detectBytesInBackground static method

Future<NsfwResult?> detectBytesInBackground(
  1. Uint8List imageData, {
  2. double threshold = _kNSFWThreshold,
})

Runs NSFW detection in a background isolate via compute.

Loads a fresh interpreter in the background isolate, runs detection, and closes the interpreter before returning the result.

Implementation

static Future<NsfwResult?> detectBytesInBackground(
  Uint8List imageData, {
  double threshold = _kNSFWThreshold,
}) {
  _validateThreshold(threshold);
  return compute(_detectInIsolate, _IsolatePayload(imageData, threshold));
}