Skip to main content

chat_message_core 0.0.4 copy "chat_message_core: ^0.0.4" to clipboard
chat_message_core: ^0.0.4 copied to clipboard

Pure Dart data models and core logic for chat messaging.

0.0.4 #

BREAKING CHANGES

  • toJson() is now deep (explicit_to_json: true): nested author, repliedMessage, previewData, image, users and lastMessages are emitted as plain maps/lists instead of model objects. jsonEncode output is unchanged.
  • AudioMessageModel.copyWith now treats an explicit null as "clear this field", like every other model. Before, passing null kept the existing value. Migration: if you forward nullable values (for example audio.copyWith(remoteId: response.remoteId)), pass only the fields you mean to change, or fall back explicitly (response.remoteId ?? audio.remoteId).
  • getPreviewData no longer puts the proxy prefix in PreviewData.link; link is always the original URL. The proxy still applies to the request and to image URLs.
  • ChatCoreRegex.regexImageContentType is now anchored (^image\/). Before, it matched any string containing "image", such as application/x-apple-diskimage.
  • Removed the unused metadata parameter from ImageMessageModel.copyWith and VideoMessageModel.copyWith
  • Room equality and hashCode now include lastMessages (compared deeply). Key maps and sets by room.id, not by Room.
  • Message equality now includes type
  • Requires Dart SDK ^3.9.2 (0.0.3 allowed ^3.7.2), because json_annotation ^4.12.0 and intl ^0.20.3 require Dart 3.9

Features

  • getPreviewData takes an optional onError(error, stackTrace) callback. Errors are also logged with dart:developer in debug builds only.

Fixes

  • copyWith on text, image and video messages no longer clears roomId when it is not passed
  • copyWith on messages keeps a custom type instead of resetting it to the default
  • MessageModel.fromJson(message.toJson()) round-trips without throwing
  • getPreviewData:
    • Direct image links return an image preview. The image body is no longer downloaded (before, it was downloaded and then failed UTF-8 decoding).
    • Direct image/svg+xml and image/gif links return only the link, matching how og:image and <img> already skip SVG and GIF
    • Non-2xx responses are treated as failed requests (link only) instead of previewing the error page
    • Non-HTML responses (PDF, video, ...) return only the link
    • Pages are decoded with the charset from the Content-Type header or a <meta> tag (UTF-8, Latin-1, ASCII). Before, any page declaring a non-UTF-8 charset returned empty data, without even the link.
    • With proxy set, several images and no imageSizeResolver, the chosen first image now has the proxy prefix
  • Removed the unused lastSeen parameter from the ChatUser.copyWith implementation

Chores

  • Dependency updates: json_annotation ^4.12.0, intl ^0.20.3, meta ^1.19.0, http ^1.6.0, html ^0.15.7
  • equatable now allows >=2.0.7 <4.0.0. With equatable 3.x, toString() in release builds (stringify off) returns Instance of '_TextMessage' instead of _TextMessage.
  • Enabled package:lints/recommended.yaml
  • Added a test suite (dart test)
  • Updated README for the 0.0.3+ API

0.0.3 #

BREAKING CHANGES

  • Moved all top-level utility functions (formatBytes, getUserInitials, getUserName, formattedDateTimeRep, calculateChatMessages, getPreviewData) into the ChatCoreFunctions class
  • Moved all top-level regex constants (regexEmail, regexImageContentType, regexLink, urlRegex, looseUrlRegex, protocolIdentifierRegex) into the ChatCoreRegex class
  • Removed ChatL10n and all locale implementations (ChatL10nEn, ChatL10nDe, ChatL10nEs, etc.)
  • Merged preview_data_fetcher.dart into functions.dart; getPreviewData now lives on ChatCoreFunctions
  • Barrel now exports all symbols from regex.dart and functions.dart (no longer selectively exported)

0.0.2 #

  • misc fixes and improvements

0.0.1 #

  • Initial release.
1
likes
160
points
675
downloads

Documentation

API reference

Publisher

verified publisherthebig3llc.com

Weekly Downloads

Pure Dart data models and core logic for chat messaging.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

equatable, html, http, intl, json_annotation, meta

More

Packages that depend on chat_message_core