chatview_utils 0.0.1 copy "chatview_utils: ^0.0.1" to clipboard
chatview_utils: ^0.0.1 copied to clipboard

Utility library for the chatview and chatview_connect libraries, containing shared type declarations. It should not be used directly.

example/main.dart

import 'dart:developer';

import 'package:chatview_utils/chatview_utils.dart';

void main() {
  // Create sample users
  const currentUser = ChatUser(
    id: '1',
    name: 'Flutter',
    profilePhoto: Constants.profileImage,
  );

  log(currentUser.toString(), name: 'ChatView Utils');

  const otherUsers = [
    ChatUser(
      id: '2',
      name: 'Simform',
      profilePhoto: Constants.profileImage,
    ),
  ];

  log(otherUsers.map((e) => e.toString()).toString(), name: 'ChatView Utils');

  // Create some initial messages
  final messages = [
    Message(
      id: '1',
      message: 'Hello!',
      createdAt: DateTime.now().subtract(const Duration(minutes: 5)),
      sentBy: '1',
      status: MessageStatus.delivered,
    ),
    Message(
      id: '2',
      message: 'Hi there!',
      createdAt: DateTime.now().subtract(const Duration(minutes: 4)),
      sentBy: '2',
      status: MessageStatus.read,
    ),
  ];

  log(messages.map((e) => e.toString()).toString(), name: 'ChatView Utils');

  // Demonstrate reaction
  final reaction = Reaction(
    reactedUserIds: [currentUser.id],
    reactions: ['👍'],
  );

  log(reaction.toString(), name: 'ChatView Utils');

  // Demonstrate reply
  final replyMessage = Message(
    id: '4',
    message: 'I am good!',
    createdAt: DateTime.now(),
    sentBy: currentUser.id,
    status: MessageStatus.pending,
    replyMessage: ReplyMessage(
      message: 'How are you?',
      messageId: '3',
      messageType: MessageType.text,
      replyTo: 'other_user_1',
      replyBy: currentUser.id,
    ),
  );
  log(replyMessage.toString(), name: 'ChatView Utils');
}
2
likes
160
points
1.17k
downloads

Publisher

verified publishersimform.com

Weekly Downloads

Utility library for the chatview and chatview_connect libraries, containing shared type declarations. It should not be used directly.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on chatview_utils