SafeText class

Legacy facade that delegates to SafeTextFilter and PhoneNumberChecker.

Deprecated. Use SafeTextFilter and PhoneNumberChecker directly. They offer better modularity, higher performance via the Aho-Corasick trie, and explicit initialization via SafeTextFilter.init.

Migration guide:

Old call New call
SafeText.filterText(...) SafeTextFilter.filterText(...)
SafeText.containsBadWord(...) SafeTextFilter.containsBadWord(...)
SafeText.containsPhoneNumber(...) PhoneNumberChecker.containsPhoneNumber(...)
Annotations
  • @Deprecated('Use SafeTextFilter and PhoneNumberChecker directly for better modularity and high performance.')

Constructors

SafeText()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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

Static Methods

containsBadWord({required String text, List<String>? extraWords, List<String>? excludedWords, bool useDefaultWords = true}) Future<bool>
Returns true if text contains a bad word.
containsPhoneNumber({required String text, int minLength = 7, int maxLength = 15}) Future<bool>
Returns true if text contains a phone number.
filterText({required String text, List<String>? extraWords, List<String>? excludedWords, bool useDefaultWords = true, bool fullMode = true, String obscureSymbol = "*", MaskStrategy? strategy}) String
Filters profanity from text.