Skip to content

ChatOperation.update() doesn't work when changing image source #889

@3rror404

Description

@3rror404

Firstly, thank you for building this amazing package. It really is excellent.

In my app, I need to be able to update the source property of an ImageMessage, however, when using ChatOperation.update to update the source, the UI doesn't update until some other event causes a rebuild.

You can test this easily by adding a ComposerActionButton to the "local" example. Sending an image message, and then tap the ComposerActionButton

ComposerActionButton(
    icon: Icons.delete_sweep,
    title: 'Update message at index 0',
    onPressed: () {
      final message = _chatController.messages[0];
      final newMessage = ImageMessage(
        id: message.id,
        authorId: message.authorId,
        createdAt: message.createdAt ?? DateTime.now().toUtc(),
        sentAt: message.sentAt ?? DateTime.now().toUtc(),
        source: '** SOME NEW IMAGE URL **',
      );
      _chatController.updateMessage(message, newMessage);
    },
    destructive: true,
  ),

I've also noticed that when the UI does rebuild, the dimensions of the new image source are not respected. For example, if the original image was portrait and the updated image is square, after rebuild the image will remain portrait.

Simulator.Screen.Recording.-.iPhone.16.-.2026-02-23.at.19.39.16.480p.mov

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions