felangel/equatable

Bad working of toString

polRk opened this issue ยท 4 comments

polRk commented

My Task object

  @override
  List<Object> get props {
    return [
      id,
      createDateTime,
      updateDateTime,
      title,
      description,
      isPriority,
      status,
      dueDate,
      startDate,
      endDate,
      reminderTime,
      recurrenceRule,
      recurrenceExceptions,
      projects,
    ];
  }

  @override
  bool get stringify => true;

and

print(task);

return

TaskEntity(95c2626a-5873-42e0-b311-36fc52db667c, 2020-12-23 18:12:06.547637, 2020-12-23 18:12:06.632105, ..., [], [])

Expected behavior
Show full record with sub records

Version
latest

polRk commented

Don't use .map function, use + instead
'$runtimeType${props?.map((prop) => prop?.toString() ?? '') ?? '()'}';

polRk commented

See my PR #95

Hi @polRk ๐Ÿ‘‹
Thanks for opening an issue!

I don't believe this is an issue with Equatable. I think this is related to flutter/flutter#22665. If you still believe this is an Equatable-specific issue can you please provide a test-case which fails with the current implementation and succeeds with the proposed changes? Thanks ๐Ÿ‘

Closing as this was fixed in #97 and published in v1.2.6 ๐Ÿ‘