sensitive_content_analysis 0.0.3 copy "sensitive_content_analysis: ^0.0.3" to clipboard
sensitive_content_analysis: ^0.0.3 copied to clipboard

Flutter package for interacting with Apple's Sensitive Content Analysis.

example/lib/main.dart

import 'dart:typed_data';

import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:sensitive_content_analysis/sensitive_content_analysis_platform.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  Future<void> sendMessageWithImage() async {
    try {
      final ImagePicker picker = ImagePicker();
// Pick an image.
      final XFile? image = await picker.pickImage(source: ImageSource.gallery);

      if (image != null) {
        Uint8List imageData = await image.readAsBytes();

        // Analyze the image for sensitive content.
        bool? isSensitive = await SensitiveContentAnalysisPlatform.instance
            .analyzeImage(imageData);
        print("SENS: $isSensitive");
      }
    } catch (e) {
      debugPrint(e.toString());
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: ElevatedButton(
            onPressed: () => sendMessageWithImage(),
            child: Text("IMAGE"),
          ),
        ),
      ),
    );
  }
}
8
likes
0
pub points
67%
popularity

Publisher

unverified uploader

Flutter package for interacting with Apple's Sensitive Content Analysis.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on sensitive_content_analysis