NsfwDetector class
NsfwDetector class handles the NSFW detection process.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → void - Closes the interpreter to release resources
-
detectBatch(
List< Uint8List> images) → Future<List< NsfwResult?> > - Detects NSFW content from a batch of image bytes sequentially.
-
detectNSFWFromBytes(
Uint8List imageData) → Future< NsfwResult?> - Detects NSFW content from bytes.
-
detectNSFWFromFile(
File imageFile) → Future< NsfwResult?> - Detects NSFW content from a file.
-
detectNSFWFromImage(
Image image) → Future< NsfwResult?> - Detects NSFW content from an image
-
detectNSFWFromUrl(
Uri url) → Future< NsfwResult?> - Detects NSFW content from a URL.
-
detectNSFWFromXFile(
XFile xfile) → Future< NsfwResult?> -
Detects NSFW content from an
XFile. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- instance → NsfwDetector
-
Returns the singleton instance, throwing if not yet initialized.
no setter
- isInitialized → bool
-
Whether the singleton has been initialized.
no setter
Static Methods
-
detectBytesInBackground(
Uint8List imageData, {double threshold = _kNSFWThreshold}) → Future< NsfwResult?> - Runs NSFW detection in a background isolate via compute.
-
disposeInstance(
) → void - Disposes the singleton instance and releases resources.
-
initialize(
{double threshold = _kNSFWThreshold}) → Future< void> - Initializes the singleton instance. No-op if already initialized.
-
load(
{double threshold = _kNSFWThreshold, bool useGpu = false}) → Future< NsfwDetector> - Loads the NSFW detector with default parameters.
-
validateThreshold(
double threshold) → void - Validates the requested threshold for tests and call-site reuse.