chat-1

A lightweight Dart package for simplifying common chat-related functionalities. This library provides convenient tools for formatting messages, handling user mentions, and more.

Installation

To use chat-1 in your Dart project, add it as a dependency in your pubspec.yaml file: yaml dependencies: chat_1: ^1.0.0 # Replace with the latest version

Then, run dart pub get to fetch the package.

Usage Examples

Here are a few examples demonstrating how to use the chat-1 package:

1. Formatting a message with bold text: dart import 'package:chat_1/chat_1.dart';

void main() { String message = "This is a normal message. This is bold text."; String formattedMessage = ChatFormatter.format(message); print(formattedMessage); // Output: This is a normal message. This is bold text. }

2. Handling User Mentions: dart import 'package:chat_1/chat_1.dart';

void main() { String message = "Hello @john.doe, how are you?"; List

String replacedMessage = ChatFormatter.replaceMentions(message, (mention) => ""); print(replacedMessage); // Output: Hello , how are you? }

3. Sanitizing Input: dart import 'package:chat_1/chat_1.dart';

void main() { String userInput = "Hello!"; String sanitizedInput = ChatFormatter.sanitize(userInput); print(sanitizedInput); // Output: Hello! }

4. Converting URLs to clickable links: dart import 'package:chat_1/chat_1.dart';

void main() { String message = "Check out this website: https://example.com"; String linkedMessage = ChatFormatter.linkify(message); print(linkedMessage); // Output: Check out this website: https://example.com }

5. Combining Formatting and Linkifying: dart import 'package:chat_1/chat_1.dart';

void main() { String message = "Important: Visit https://example.com for more details."; String formattedAndLinked = ChatFormatter.format(ChatFormatter.linkify(message)); print(formattedAndLinked); // Output: Important: Visit https://example.com for more details. }

Feature Summary

The chat-1 package offers the following features:

  • Text Formatting: Provides functionality to format text with basic markup (e.g., bold, italics).
  • User Mention Handling: Extracts and replaces user mentions within chat messages.
  • Input Sanitization: Sanitizes user input to prevent potential security vulnerabilities.
  • URL Linkification: Automatically converts URLs in messages into clickable links.
  • Extensible Architecture: Designed with extensibility in mind, allowing developers to easily add custom formatting rules and functionalities.
  • Clean API: Simple and intuitive API for ease of use.

License

This package is released under the MIT License. See the LICENSE file for more details.

This package is part of the chat-1 ecosystem. For advanced features and enterprise-grade tools, visit: https://supermaker.ai/chat/

Libraries

chat_1