Skip to content
pubscout

bad_words

0.3.0, released 5 years ago by an unverified publisher

A Dart filter to check if a string contains English bad words and clean them.

WASM-ready
$ flutter pub add bad_words
Source repository

What it does

Provides a Filter class to check strings for profane English words. Also allows cleaning profane strings by replacing bad words with asterisks.

AI-written summary of version 0.3.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to validate user-generated input for English profanity
  • You want to censor or mask bad words in text strings

Skip it when

  • You need support for languages other than English
  • You need advanced NLP or context-aware sentiment analysis

Strengths

  • Simple and straightforward API
  • Includes both checking and cleaning functionality
  • Zero dependencies

Weaknesses

  • Limited to English language only
  • Word list is static and defined internally

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
0
import 'package:bad_words/bad_words.dart';

final filter = Filter();

if (filter.isProfane('some string to test')) {
    // validation error etc.
}

final cleanString = filter.clean('some test string');

Alternatives

Packages that do the same job and could replace bad_words.

  • validators2

    String validation and sanitization for Dart.

  • iregexp

    Dart implementation of RFC 9485 I-Regexp, validating and matching patterns.

  • pluralize

    Pluralize and singularize any word and check if it is singular or plural.

  • profanity_filter

    Check and censor strings against profanity and obscene words with a built-in English list.