NsfwMethodChannel class

Inheritance

Constructors

NsfwMethodChannel()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scanEventStream Stream<Map>
no setteroverride

Methods

addAssetsToAlbum(List<String> localIdentifiers, String albumId) Future<void>
Add assets to an album. See NsfwDetector.addAssetsToAlbum.
override
availableModels() Future<List<ModelDescriptor>>
override
cachedResult(String localIdentifier, {String? modelId}) Future<Map?>
Look up a cached scan record for localIdentifier without triggering a re-scan. Returns the wire-shape map (mirrors scanSingleAsset) when a row exists, or null on miss. Default throws.
override
cancelBackgroundSweep() Future<void>
Cancel any pending background sweep. Default no-op — safe to call even if none was scheduled.
override
cancelScan() Future<void>
override
checkCameraPermission() Future<PermissionStatus>
override
checkPermission() Future<PhotoLibraryPermissionStatus>
override
checkPlatformSetup() Future<PlatformSetupReport>
override
clearScanCache({String? modelId}) Future<void>
Clear the persistent scan-result cache. Default no-op.
override
createAlbum(String title) Future<String>
Create an album, returning its new local identifier.
override
deleteAssets(List<String> localIdentifiers) Future<bool>
Delete assets (OS shows its own confirmation). Returns true when the user confirmed, false when they cancelled. See NsfwDetector.deleteAssets.
override
deleteModel(String modelId) Future<void>
Delete a previously-downloaded model. Default no-op.
override
downloadModel(String modelId, {String? url}) Future<bool>
Download a downloadable model. Default throws.
override
listAlbums() Future<List<Map>>
List user albums as {id, title, count, isUserAlbum} maps.
override
listAssetIdentifiers({String mediaType = 'image', int? limit}) Future<List<String>>
Enumerate photo-library asset identifiers (creationDate desc), so a Dart-driven batch ensemble scan can iterate them. mediaType is 'image' (default), 'video', or 'any'; limit caps the count (0/null = all). Default throws.
override
loadThumbnail(String localIdentifier, {int maxWidth = 256, int maxHeight = 256}) Future<Uint8List?>
Load a downscaled thumbnail (JPEG bytes) for the photo-library asset identified by localIdentifier. Returns null when the asset cannot be resolved or decoded. maxWidth/maxHeight are an upper bound in logical pixels; aspect ratio is preserved. Default throws.
override
moveAssetsToAlbum(List<String> localIdentifiers, String toAlbumId, {String? fromAlbumId}) Future<void>
Move assets to toAlbumId (add), optionally removing them from fromAlbumId. See NsfwDetector.moveAssetsToAlbum.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pickMedia({required String type, required bool multiple, int? maxItems}) Future<List<Map>>
Pure media picker (no classification). Default throws.
override
prefetchAssets(List<String> localIdentifiers, {String? modelId}) Future<void>
Pre-warm the native asset cache for the given local identifiers so the next scanSingleAsset or library scan can decode them with less I/O pressure. Default no-op — platforms without a meaningful warm-cache implementation just return.
override
preloadModel(String modelId) Future<void>
Compile / warm the model. Default no-op so test mocks don't need to stub.
override
redactBytes({required Uint8List bytes, required List<Map<String, Object?>> detections, required String mode, required double intensity, String? outputFormat}) Future<Uint8List>
Redact the supplied image bytes against the given detection list. Mode strings: "blur", "pixelate", "blackBox". Default throws.
override
redactFile({required String inputPath, required List<Map<String, Object?>> detections, required String mode, required double intensity, String? outputPath}) Future<String>
Redact an image file on disk. outputPath when null writes to a sibling temporary file. Returns the on-disk path of the redacted output. Default throws.
override
registerModel(Map<String, Object?> registration) Future<String>
Register a custom model descriptor at runtime. Returns the resolved asset path the native side will load from. Default throws.
override
removeAssetsFromAlbum(List<String> localIdentifiers, String albumId) Future<void>
Remove assets from an album. See NsfwDetector.removeAssetsFromAlbum.
override
requestCameraPermission() Future<PermissionStatus>
override
requestPermission() Future<PhotoLibraryPermissionStatus>
override
resetScan() Future<void>
Reset scan state (clears native checkpoints, etc.). Default no-op.
override
scanFilePath(String filePath, {String? modelId, Map<String, double>? roi}) Future<Map>
Scan an image file from path. Default throws. roi is a normalised {x, y, width, height} map in [0, 1]; native implementations that don't support cropping should ignore the key.
override
scanImageBytes(Uint8List bytes, {String? modelId, Map<String, double>? roi}) Future<Map>
Scan raw image bytes. Default throws. See scanFilePath for the roi contract.
override
scanSingleAsset(String localIdentifier, {String? modelId, Map<String, double>? roi}) Future<Map>
override
scheduleBackgroundSweep(Map<String, Object?> options) Future<void>
Schedule a recurring background scan. Default throws — host-app integration is required (Info.plist on iOS, WorkManager classpath on Android — see BackgroundSweepOptions docs).
override
setAssetFavorite(String localIdentifier, bool favorite) Future<void>
Toggle the favorite flag on the asset. See NsfwDetector.setAssetFavorite.
override
setAssetHidden(String localIdentifier, bool hidden) Future<void>
Toggle the hidden flag on the asset. See NsfwDetector.setAssetHidden.
override
setLogging(bool enabled) Future<void>
Toggle native logging. Default no-op.
override
setModelUrl(String modelId, String url) Future<void>
Set a custom download URL for a model. Default no-op.
override
skipCurrentAsset() Future<void>
Signal the native scan loop to skip the next asset it would process. Best-effort: one outstanding skip is consumed by the next per-asset task that checks the flag. No effect when no scan is running.
override
startCameraScan(CameraConfiguration config) Future<void>
override
startPickAndScan(ScanConfiguration config, int maxItems) Future<void>
Picker scan. Default throws — enable by overriding in your native impl.
override
startScan(ScanConfiguration config) Future<void>
override
stopCameraScan() Future<void>
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited