local_toxicity_guard 1.0.1 copy "local_toxicity_guard: ^1.0.1" to clipboard
local_toxicity_guard: ^1.0.1 copied to clipboard

Privacy-focused on-device toxicity detection for Flutter. Detects hate speech, harassment, and offensive content without cloud APIs.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:local_toxicity_guard/local_toxicity_guard.dart';
import 'package:local_toxicity_guard/services/toxicity_guard.dart';

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

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

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

class _MyAppState extends State<MyApp> {
  final _localToxicityGuardPlugin = LocalToxicityGuard();
  final TextEditingController _textController = TextEditingController();

  @override
  void initState() {
    super.initState();
  }

  @override
  void dispose() {
    _textController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(title: const Text('Toxicity Validation')),
        body: Padding(
          padding: const EdgeInsets.all(16),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              TextField(
                controller: _textController,
                decoration: const InputDecoration(
                  border: OutlineInputBorder(),
                  labelText: 'Enter text',
                ),
                minLines: 3,
                maxLines: null,
              ),
              const SizedBox(height: 16),
              ElevatedButton(
                onPressed: () async {
                  String text = _textController.text;
                  ToxicityResult? result = await _localToxicityGuardPlugin
                      .detectToxicity(text);

                  print('Toxicity Result: $result');
                },
                child: const Text('Validate'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
150
points
74
downloads

Publisher

unverified uploader

Weekly Downloads

Privacy-focused on-device toxicity detection for Flutter. Detects hate speech, harassment, and offensive content without cloud APIs.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_onnxruntime, plugin_platform_interface

More

Packages that depend on local_toxicity_guard

Packages that implement local_toxicity_guard