heroiclabs / nakama-dart

Pure Dart Client for Nakama Server
https://heroiclabs.com/docs/nakama/client-libraries/dart
157 stars 48 forks source link

Notification fromDTO missing the subject + content #80

Closed iammuho closed 6 months ago

iammuho commented 6 months ago

Describe the bug When we are listening the notifications from the socket, the subject + content is being null, because fromDTO doesn't parse them.

https://github.com/heroiclabs/nakama-dart/blob/main/lib/src/models/notification.dart#L24-L30

Reproduction Code

socket
        .onNotifications
        .listen((notification) {
      print(notification.subject);
      print(notification.content);
    });

It'll give the null values.

Expected behavior Subject and content are filled with the values.

Solution:

  factory Notification.fromDto(api.Notification dto) => Notification(
        id: dto.id,
        code: dto.code,
        subject: dto.subject,
        content: dto.content,
        senderId: dto.senderId,
        createTime: dto.createTime.toDateTime(),
        persistent: dto.persistent,
      );
obrunsmann commented 6 months ago

Thank you for reporting, I'll fix that an release a patch version.