Skip to content
pubscout

string_contains

2.4.0, released 3 years ago by betterx.io

String scanner extensions and widgets to detect and clean bad words, URLs, emails, phones, and tags.

WASM-ready
$ flutter pub add string_contains
Source repository

What it does

Provides Dart String extensions to check for, extract, and clean bad words, URLs, emails, phone numbers, hashtags, and mentions. It also includes Flutter widgets like StringContainsWidget and CleanWidget to highlight or censor these elements in text.

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

Use it when

  • You need to detect, highlight, or clean URLs, emails, and phone numbers inside user-generated text.
  • You want to filter or obscure bad words or specific keywords within strings.

Skip it when

  • You need a comprehensive, fully automated content moderation solution for enterprise-grade safety.
  • You only require a standard URL launcher without text parsing features.

Strengths

  • Provides both powerful String extension methods and ready-to-use Flutter widgets.
  • Supports multiple patterns including URLs, emails, phone numbers, hashtags, mentions, and custom words.
  • Offers flexible cleaning options with customizable obscuring characters and letter preservation.

Weaknesses

  • Not a complete replacement for human review or advanced AI-based content moderation.
  • Relies on regex and predefined lists which may produce false positives or miss context-dependent slang.

Setup

Kind
Flutter widgets
Effort
Low
Code generation
No
Direct dependencies
0
final String? nullableString = "International phone number +91-9000000001.";
print(nullableString.containsPhoneNumber()); // returns true
print(nullableString.getPhoneNumbers()); // returns ['+91-9000000001']

Alternatives

Packages that do the same job and could replace string_contains.