safe_text 2.1.0
safe_text: ^2.1.0 copied to clipboard
A Flutter package for filtering out bad words from text inputs and detecting phone numbers in various formats including multiplier words.
2.1.0 #
Added #
MaskStrategyAPI: New sealed class with three strategies for controlling how profanity is masked:MaskStrategy.full({obscureSymbol})— replaces every character (e.g."badass"→ ``"******"`).MaskStrategy.partial({obscureSymbol})— keeps first (and last, for 4+ char words) visible (e.g."damn"→"d**n").MaskStrategy.custom({replacement})— replaces the entire word with a fixed string (e.g."[censored]").
strategyparameter onSafeTextFilter.filterTextand the deprecatedSafeText.filterTextto accept aMaskStrategy.
Changed #
- Legacy
fullModeandobscureSymbolparameters onfilterTextare now deprecated in favour ofMaskStrategy. Existing call sites continue to work unchanged. MaskStrategyis exported from the top-levelsafe_text.dartbarrel file.
2.0.1 #
Documentation #
- Rewrote README with pub.dev badges, full API reference tables, supported languages list, migration guide from v1.x, How it Works section, and Limitations section.
- Fixed CHANGELOG entries for 1.0.5–1.0.7: corrected
Addedcategory toFixed/Changedfor bug fix and refactor entries.
2.0.0 #
Added #
- Aho-Corasick Engine: Replaced legacy regex loops with a high-performance Trie-based search engine for
O(N)search complexity. - Extreme Performance: Up to 20x faster for large pattern sets and mixed language inputs.
- Flexible Initialization:
SafeTextFilter.initnow supports either a singlelanguageor a list oflanguagesfor custom combinations. - Multilingual Support: Support for 75+ languages with full names (e.g.,
Language.english,Language.hindi). - Modular API: Separated functionality into
SafeTextFilterfor profanity andPhoneNumberCheckerfor phone detection. - Single-Pass Replacement: Optimized string building avoids multiple copies during filtering.
Deprecated #
- SafeText Class: The monolithic
SafeTextclass is now deprecated. UseSafeTextFilterandPhoneNumberCheckerdirectly for better performance and modularity.
1.0.8 #
Added #
- Added support for detecting phone numbers with repeated digits using multiplier words (e.g., "double five" → "55", "triple four" → "444").
1.0.4 #
Added #
- A method to check whether the given String contains any phone number or not both in words and digits and in mixed format also.
1.0.3 #
Added #
- A method to check whether the given String contains any bad words or not. Process will run in new thread to avoid blocking of main thread.
1.0.0 #
Published #
- Initial release of the BadWordFilter package.
- Implemented the
SafeTextclass with thefilterTextmethod for filtering out bad words from text inputs. - Provided customizable options for filtering bad words, including extraWords, excludedWords, useDefaultWords, fullMode, and obscureSymbol.
- Included an example Flutter app demonstrating the usage of the BadWordFilter package.
- Added a README.md file with instructions on getting started, usage, example, and author information.