mofilo_content_filter 1.0.3
mofilo_content_filter: ^1.0.3 copied to clipboard
A comprehensive content filtering package for Flutter that blocks offensive language, hate speech, profanity, and harmful content in multiple languages with advanced bypass detection.
Mofilo Content Filter #
Multi-layer content filtering for Flutter apps. Blocks offensive language, hate speech, and harmful content with 12+ detection layers.
Quick Start #
import 'package:mofilo_content_filter/mofilo_content_filter.dart';
// Check any text input
final result = ContentFilter.check(userInput);
if (result.isBlocked) {
showError('This content is not allowed');
} else {
submitContent(userInput);
}
That's it! The filter handles the rest.
Features #
- ๐ก๏ธ 12+ Detection Layers - Catches sophisticated bypass attempts
- ๐ Multi-Language - English, Spanish, French, German, Polish, Russian, Portuguese, Italian, Dutch
- โก Fast & Offline - <5ms latency, no external API calls
- ๐ Privacy-Friendly - All processing happens locally
- ๐ฏ Comprehensive - Profanity, slurs, hate speech, violence, CSAM, terrorism
- ๐งช Well-Tested - 870+ comprehensive tests
Installation #
Add to your pubspec.yaml:
dependencies:
mofilo_content_filter: ^1.0.3
Then run:
flutter pub get
Usage Examples #
Basic Usage (Recommended) #
import 'package:mofilo_content_filter/mofilo_content_filter.dart';
final result = ContentFilter.check("chocolate cake");
if (result.isBlocked) {
print('Blocked: ${result.reason}');
print('Severity: ${result.severity}');
} else {
print('Content is safe!');
}
Validate Food Names #
final result = ContentFilter.validateFoodName("apple pie");
if (result.isAllowed) {
saveFoodName("apple pie");
}
Validate Multiple Fields #
final results = ContentFilter.validateAll(
foodName: "pizza",
brandName: "Pizza Hut",
);
if (results.isEmpty) {
// All fields are safe
saveToDatabase();
} else {
// Show which fields failed
results.forEach((field, result) {
print('$field: ${result.reason}');
});
}
What Gets Blocked #
Language-Based Content #
- Profanity and vulgar language
- Racial, ethnic, and religious slurs
- Homophobic and transphobic slurs
- Sexist and misogynistic language
- Ableist slurs
Harmful Content #
- Hate speech and Nazi/white supremacy symbols
- Terrorism and extremism references
- Self-harm and suicide encouragement
- Child abuse (CSAM) references
- Sexual harassment and violence
- Drug references
Technical Attacks #
- SQL injection attempts
- XSS (Cross-Site Scripting)
- Spam and gibberish patterns
- Encoded malicious content
Advanced Bypass Detection #
Defends against sophisticated bypass techniques:
- Character Substitution - l33tspeak (f0ck, sh1t), symbols (@ss, f*ck)
- Spacing/Separators - f.u.c.k, f-u-c-k, f u c k
- Unicode Tricks - Cyrillic (ัuck), fullwidth (๏ฝ๏ฝ๏ฝ๏ฝ), circled (โโคโโ)
- Zero-Width Characters - Invisible Unicode characters
- Emojis - f๐u๐c๐k
- Encoding - Base64, ROT13, Hex, reversed text
- Mixed Case - FuCk, FUCK, fUcK
- Asterisks - fk, ner
- Homoglyphs - Visually similar characters
- Fuzzy Spelling - Levenshtein distance matching
Best Practices & Limitations #
โ Best Used For: #
- Food names and brand names
- Product titles and descriptions
- Usernames and display names
- Form inputs with limited scope
- First-pass content filtering
โ ๏ธ Important to Know: #
This is a first-line defense tool. Like all automated filters, it's not perfect:
- Not 100% accurate - May produce false positives or miss some content
- Context matters - Best for names/titles, not ideal for full conversations
- Human review recommended - Especially for chat, comments, and user-generated content
- Best practices - Use as your first filter, add human moderation as backup
For comprehensive content moderation, combine this filter with:
- User reporting system
- Human review queue for flagged content
- Regular monitoring and updates
See DISCLAIMER.md for complete details.
Result Object #
class ContentFilterResult {
final bool isAllowed; // Whether content passes filter
final bool isBlocked; // Opposite of isAllowed
final String? reason; // Reason for blocking (if blocked)
final List<String> violations; // Specific violations found
final ContentFilterSeverity severity;
}
enum ContentFilterSeverity {
none, // Content is safe
low, // Suspicious but might be legitimate
medium, // Likely violation
high, // Definite violation
critical, // Severe violation (slurs, hate speech, CSAM)
}
Performance #
- โก Latency: <5ms on average
- ๐ Privacy: All processing happens locally, no external APIs
- ๐ฑ Offline: Works without internet connection
- ๐งช Tested: 870+ comprehensive tests across bypass techniques
Use Cases #
Companies Using This #
Great for apps that need content filtering for:
- Food & recipe apps (filter inappropriate food names)
- E-commerce platforms (filter product names)
- Social platforms (filter usernames, bio text)
- Gaming platforms (filter clan names, character names)
- Business directories (filter business names)
License & Legal #
MIT License - Copyright (c) 2025 Mofilo
This software is provided "AS IS" without warranty of any kind. See LICENSE for full terms.
Important: By using this package, you accept full responsibility for content moderation in your application. See DISCLAIMER.md for complete legal terms and limitations.
Published by Mofilo