Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support embedded objects #829

Open
wants to merge 22 commits into
base: develop
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Change ToString()
hendrikvdkaaden committed May 29, 2024
commit ffcd2202de7777515097a8476f220ee778406e76
2 changes: 1 addition & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -180,7 +180,7 @@ class TaskListCell extends StatelessWidget {
child: ListTile(
title: Text(task.message),
subtitle: Text('Status: ${task.statusTitle}'),
trailing: Text(task.timestamp.toString()),
trailing: Text(task.timestamp.format()),
),
confirmDismiss: (direction) async {
String? statusMessage;
10 changes: 7 additions & 3 deletions example/lib/timestamp.dart
Original file line number Diff line number Diff line change
@@ -22,11 +22,15 @@ class Timestamp {
@override
int get hashCode => createdAt.hashCode ^ updatedAt.hashCode;

@override
String toString() {
String format() {
final DateFormat formatter = DateFormat('yyyy-MM-dd');
final String formattedCreatedAt = formatter.format(createdAt);
final String formattedUpdatedAt = formatter.format(updatedAt);
return 'createdAt: $formattedCreatedAt \n updatedAt: $formattedUpdatedAt';
return 'Created at: $formattedCreatedAt \nUpdated at: $formattedUpdatedAt';
}

@override
String toString() {
return 'Timestamp(createdAt: $createdAt, updatedAt: $updatedAt)';
}
}